This indicates that if any POST
operation results in the creation of a resource, the response Include a location
header with the address of the new resource.
If a source is built on the original server, the response should be 201 (manufactured) and in it there is a unit that describes the status of the request and new resources and location headers (see Section 14.30 ).
and section 14.30,
For 201 (built) responses, this location is the new resource that was made by the request.
Now suppose that my API allows batch creation of resources by Since two The question is similar, but This reaction asks about the unit, is not it (And not unanswered). \ book {bookId}
resources have been created, what should be the location of in the
header in this case?
I know that this is late for the North Party But I believe the best solution is to create a new batch processing with a UUID identifier which will return the list of the URLs that were added using the URL in this way:
http : //api.example.com/batches/ {uuid}
Like
http://api.example.com/batches/2b9b251f71a4b2901d66e04725bc0c9cb5843c74 < / Code>
Then your post
or PUT
Header and a 201 - Created
status code
If you then return to GET
Then, along with the list of URLs that were created in that batch, any other information about batch such as yewood and time / date was created.
{"uuid": "2b9b251f71a4b2901d66e04725bc0c9cb5843c74", "day-time": "2005-08-15T15: 52: 01 + 00: 00", "Books": ["http: / /api.example.com/books/the-colour-of-magic "," http://api.example.com/books/the-light-fantastic "]}
Those resources can be an hour or a month's TTL, whichever you choose, if they want that they can live forever; Whatever your use-case is needed
No comments:
Post a Comment