Non Restful request


#1

Hi,

Firstly thank you for the hard work that has gone into providing this standard, long may it continue :slight_smile:.

I am new to this, about 1 week of usage and trying to understand and I would like to know the best practice for managing non rest actions. As an example, I have a system that can CRUD rooms, however, there is a need to batch create rooms. Naturally (i think) I would use GET/POST/PATCH/DELETE on the /rooms route and provide the relevant json (where applicable) what strategy should I use to do a batch action. The action would create Rooms with a parameter Quantity used to loop and create that many rooms. I assume i would return the rooms created in the response but do not know the best structure for the request.

Many thanks


#2

There’s a long-standing joke in the REST world:

What’s the answer to every question about REST?

Make another resource.

Resources do not have to map to a database table. Need to batch create
rooms? Then create a resource that lets you batch create rooms. That’s
totally fine.


#3

Ha ha…i’ll try that one at work tomorrow. :slight_smile:

I assume I would not pass an id and send the request via post. Would it also be correct to return the new resources (rooms) created? does that break any conventions?

Cheers