thePhenomanalB
thePhenomanalB

Reputation: 15

What should the Header of a Created Response contain, if there is no Endpoint to acces the created Resource

If i have a post endpoint for a car, but only get endpoints for a collection of cars, what should be the created URL in the Response. Usually it should be cars/{id-of-new-car} But since that endpoint does not exists, that URL is misleading.

Upvotes: 0

Views: 32

Answers (1)

Evert
Evert

Reputation: 99533

If you only have a collection, and you used POST on that collection to add a new car, you didn't create any new resources, you just updated one (the collection).

So if your question is: What should go in the Location header that goes along with the 201 Created response, I'd say you probably don't need either.

Upvotes: 1

Related Questions