Successful requests get a response in the 200 or 300 range.
When creating or updating a resource, the resulting JSON representation will be rendered in the response body and a Location header pointing to the resource.
Example response for create call using POST:
Status: 201 CreatedLocation: https://{subdomain}.grouplink.com/api/assets/123{ "asset": { "id": 123, "name": "Wibble", ... "created_at": "2012-04-04T09:14:57Z" }} |
Unsuccessful requests get a reponse in the 400 range. The response content type may be text/plain for API level error messages. The response content type application/json will be used for business level error messages.
Status: HTTP/1.1 400{ errors: [ { "field": "assetNumber", "message": "assetNumber cannot be blank" } ]} |
Responses with status codes in the 500 range are used for server errors or other internal issues.
The typical successful response for a GET request will contain a "content" field, which will contain the actual resource data. The response may contain other fields, such as "links", for additional information related to the resource or request. This is in keeping with the HATEOAS principle. See http://spring.io/understanding/HATEOAS
Status: HTTP/1.1 200 OK{ content: { "id": 123, "assetNumber": "AST-123", "name": "Asset 123", ... }, links: [ { "rel": "self", } ]}