API Response Standard Documentation
General Structure
Every API response will consist of the following core properties:
status
: A string indicating the outcome of the API request ("success"
or"failure"
).data
: The data returned by the API, whose structure can differ based on the request type.error
orerrors
: Error details will be included here if thestatus
is"failure"
.
Successful Responses
Single Resource
For single-resource responses, the data
field will contain the resource object:
List of Resources
For multi-resource (list) endpoints, the data
field should contain an items
property, which is an array of resource objects. Additionally, total
and next
properties are included:
items
: An array of resource objects.total
: The total number of available resources, useful for pagination.next
: The URL for the next set of resources in the pagination series.
Error Responses
Single Error
When an error is encountered, the status
field should be "failure"
, and the error
field should provide details:
Multiple Errors
When multiple errors need to be reported, the errors
field should contain an array of error objects:
Last updated