- Responses should be standardized. Consumer should expect always that will get same response structure whether was for successful or error responses.
- Consumer should expect that HTTP Status codes will be used correctly, and our defined statuses should be documented.
- There are lot of status codes to go through each of them so here is a link where each of them is listed and described: http://www.restapitutorial.com/httpstatuscodes.html
- Known issues with status codes and responses:
- Reverse proxy server can change the response if status is 4xx
Response structure for INSERTING, UPDATING single record
Examples
For Success response
{ record: { ...//fields and updated values }, message: “msg.key”, error: null } |
For Error response
{ record: { ...//sent fields and values }, error: { error_code:14, general_message:"msg.key", messages:['msg.key1', 'msg.key2'], error_fields:[ {field1:"msg.key1"}, {field2:"msg.key2"}, ] } } |
Response structure for RETRIEVING records
Example: Probably we should use same structure like SOLR or something similar
{ filter: { f-status: ACTIVE, start: 0, limit: 10 }, response: { total: 123, data: [ …//actual records ] } } |
Comments
0 comments
Please sign in to leave a comment.