#latest version https://api.machbasecloud.com/ #specific version 1 https://api.machbasecloud.com/v1/ |
Content-Type: application/json; charset=utf8 x-api-key: {API Key} |
The response of all requests must follow the format below, and the response in the description of each API describes only the value of the "data" key.
{ "status" : "success" or "fail" or "error", "data" : { .... } } |
When setting up a JSON API, you'll have all kinds of different types of calls and responses. JSend separates responses into some basic types, and defines required and optional keys for each type:
Type | Description | Required Keys | Optional Keys |
---|---|---|---|
Success | All went well, and (usually) some data was returned. | status, data | |
Fail | There was a problem with the data submitted, or some pre-condition of the API call wasn't satisfied | status, data | |
Error | An error occurred in processing the request, i.e. an exception was thrown | status, data | code, data |
success
{ status : "success", data : { "tag_1" : [ .... ], "tag_2" : [ .... ] } } { status : "success", data : { "id" : 2, "title" : "Another blog post", "body" : "More content" } } { status : "success", data : null } |
fail : When an API call is rejected due to invalid data or call conditions.
{ "status" : "fail", "data" : { "title" : "A title is required" } } |
error : When an API call fails due to an error on the server.
{ "status" : "error", "message" : "Unable to communicate with database" } |