Default response » History » Version 2
Ryan Supawarapong, 02/19/2026 06:00 AM
| 1 | 1 | Ryan Supawarapong | # Default response |
|---|---|---|---|
| 2 | |||
| 3 | 2 | Ryan Supawarapong | Basic example: |
| 4 | ``` |
||
| 5 | { |
||
| 6 | status : "success", |
||
| 7 | data : { |
||
| 8 | "post" : { "id" : 1, "title" : "A blog post", "body" : "Some useful content" } |
||
| 9 | } |
||
| 10 | } |
||
| 11 | ``` |
||
| 12 | |||
| 13 | 1 | Ryan Supawarapong | This is the default response body for the project. Refer to [jsend](https://github.com/omniti-labs/jsend) for more detail on the standard. |
| 14 | |||
| 15 | | Key | Type | Value | Description | |
||
| 16 | | --- | ---- | ----- | ----------- | |
||
| 17 | | status | string | "success", "failed", "error" | status to indicated the response status | |
||
| 18 | | message | string | "" | only used the status is error | |
||
| 19 | | data | map[string]any | "data":{"test1":"value"} | detail for the response | |
||
| 20 | | xid | string | "061b8631-0caa-4ec0-8b6f-fe9e43703dd0" | xid string for debugging and tracing purpose | |
||
| 21 | |||
| 22 | |||
| 23 | ## Status detail |
||
| 24 | |||
| 25 | <table> |
||
| 26 | <tr><th>Type</td><th>Description</th><th>Required Keys</th><th>Optional Keys</td></tr> |
||
| 27 | <tr><td>success</td><td>All went well, and (usually) some data was returned.</td><td>status, data</td><td></td></tr> |
||
| 28 | <tr><td>fail</td><td>There was a problem with the data submitted, or some pre-condition of the API call wasn't satisfied</td><td>status, data</td><td></td></tr> |
||
| 29 | <tr><td>error</td><td>An error occurred in processing the request, i.e. an exception was thrown</td><td>status, message</td><td>code, data</td></tr> |
||
| 30 | </table> |