I am working on a message request which will have complete request details used to create a record in destination.
This integration create 3 different type of records (Order, shipment, invoice) at different times i.e. it will not always possible to create all at once, so I need to let the system know to create only certain requests.
My questions, what would be the best to way to add this information in request?
Does it need to be in body of the request?
{ "OrderNumber": "1234", "operation": [ "orderentry", "shipment", "invoice" ] }Does it need to be in path?
/Order/create?operation=orderentryDoes it need to be in seperate object? say
{ "operation": [ "orderentry", "shipment", "invoice" ], "request": { "OrderNumber": "1234", } }
The effective uri of the request should identify the document that is being modified; the payload should be the document that describes the modification.
/home.html identifies the document we are modifying; the body tells us about the modification that the client wants to make.
The uniform interface constraint ensures that everyone (servers, clients, intermediary components) all interpret this message the same way -- the semantics of the request are the same everywhere, as are the semantics of the response.
Note that we don't send the request to
/home.html?editor/home.html?operation=editbecause those are two different resources (we know this, because the identifiers are different). By correctly identifying the resource we are modifying in the request, we make it clear to general purpose components what is going on, so that they can do intelligent things (like invalidating caches).Whether or not the information needs to be in a "separate object" is a matter of schema design; HTTP really doesn't care what schemas you use in the documents that you are transferring over a network.