Domanda

I'm developing a RESTful web service and want to follow the HATEOAS concept. There are tons of examples out there on what should a GET response look like according to HATEOAS, but I couldn't find a good example on response after a successful resource creation.

How should the HATEOAS part of the response headers and body look like?

Thanks for help

È stato utile?

Soluzione

Probably the most salient piece of information that can be returned from a resource creation request is a Link to the resource itself, usually as a self link in the response. Other than this the body of the response for creation of a resource could be many things: empty, some information about the resource created or (most likely) a representation of the resource itself.

If the request creates a new resource you should probably be returning a 201 CREATED status code.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top