I have an API that allows clients to post Request messages via a uri: [url]/Request
The Request message is xml:
<Request>
<Source>1234</Source>
<Destination>5551111</Destination>
<Message>Hello</Message>
</Request>
The response message is
<Response>
<Id>2589</Id>
<Status>Stored</Status>
</Response>
Is it correct, in the REST sense for the service located at /Request to return in the HTTP Response a Response message?
Or, should the /Request post return a url to something like
/Response?MessageId=2589
where a Response messsage is returned?
The HTTP specification has this to say about the
POSTrequest:So, technically, if an entity is included in the POST response it should describe the status of the request. What constitutes the
status of the requestthough, is entirely up to the implementor. Most large implementation will return a representation of the newly created resource to indicate ‘Success’, and an error message to indicate ‘Failure’. In any case, you will want to set theLocationheader of the response to be the URI of the newly created resource.