Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

JSON Success Response

My JSON API standard response which can also be yours.



Param Type Description
success boolean true if ok, false if error
code number server status code
message string server message
result string, number, boolean, array, object, null response result
time string response time in ISO standard

Example

Response ok

HTTP/1.1 200 OK
Content-Type: application/json
{
  "success": true,
  "code": 200,
  "message": "OK",
  "result": 123,
  "time": "2017-08-30T09:59:00.846Z"
}

Response error

HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
  "success": false,
  "code": 401,
  "message": "Unauthorized",
  "result": null,
  "time": "2017-08-30T09:59:00.846Z"
}

Author

Fabio Ricali

License

MIT

About

A standard JSON API response

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors