|
|
|
|
|
by sujeetsr
5933 days ago
|
|
But what this doesn't say is, how do I get the structure of the data that I should post to a RESTful resource? For example, in level 3, with a starting uri of /doctors/mjones/slots?date=20100104&status=open, I get back two additional uris of the two slots, and if I want to book one, I send a POST to /slots/1234, with an xml structure containing the patient id. So, to be a completely discoverable api, shouldnt the response also tell me what the xml structure should look like? When you look at a wsdl file, it tells you both where the service is located, as well as the structure of the data that one must send to it. I haven't been able to find an equivalent for the second part in the REST world. Anyone know? |
|
Ideally you would get different kinds of responses for the same resource by using the Accept header, so that browsers get text/html but your app gets application/xml or whatever you asked for. Unfortunately everyone seems to be following Rails' lead of just appending extensions onto the end of URLs — if you're lucky they'll use HATEOAS, but they usually just expect you to concatenate strings on your end using foreknowledge.