Skip to content

Instantly share code, notes, and snippets.

@songcser
Last active February 6, 2018 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save songcser/ae8af65f33f34f09f265879e107cb584 to your computer and use it in GitHub Desktop.
Save songcser/ae8af65f33f34f09f265879e107cb584 to your computer and use it in GitHub Desktop.
Rest API Responses
200 OK Success
304 Not Modified There was no new data to return.
400 Bad Request The request was invalid or cannot be otherwise served. An accompanying error message will explain further. Requests without authentication are considered invalid and will yield this response.
401 Unauthorized Missing or incorrect authentication credentials. Also returned in other circumstances (for example, all calls to API v1 endpoints return 401).
403 Forbidden The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits . Other reasons for this status being returned are listed alongside the response codes in the table below.
404 Not Found The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method.
406 Not Acceptable Returned when an invalid format is specified in the request.
410 Gone This resource is gone. Used to indicate that an API endpoint has been turned off.
420 Enhance Your Calm Returned when an application is being rate limited .
422 Unprocessable Entity Returned when an image uploaded to POST account / update_profile_banner is unable to be processed.
429 Too Many Requests Returned when a request cannot be served due to the application’s rate limit having been exhausted for the resource. See Rate Limiting .
500 Internal Server Error Something is broken. Please post to the developer forums with additional details of your request, in case others are having similar issues.
502 Bad Gateway The servers is down or being upgraded.
503 Service Unavailable The servers are up, but overloaded with requests. Try again later.
504 Gateway timeout The servers are up, but the request couldn’t be serviced due to some failure within our stack. Try again later.
GET http://localhost/users/<id:int>/
HTTP/1.1 200
Content-Type: application/json
{
code: 0,
data: {
id: 0,
name: "test"
}
}
GET http://localhost/users/?page=1&limit=20 default: page=0, limit=20
HTTP/1.1 200
Content-Type: application/json
{
code: 0,
data: [{
id: 0,
name: "test"
},]
pagination:{
total: 100,
page: 1,
limit: 20
}
}
POST http://localhost/users/
HTTP/1.1 201
Content-Type: application/json
{
code: 0,
data: {
id: 1
}
}
PUT http://localhost/users/<int:id>/
HTTP/1.1 200
Content-Type: application/json
{
code: 0
}
DELETE http://localhost/users/<int:id>
HTTP/1.1 204
Content-Type: application/json
{
code: 0,
}
GET http://localhost/users/<id:int>/
HTTP/1.1 404
Content-Type: application/json
{
code: 20202,
message: "server error",
errors:[
"email is error",
"phonenumber is error"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment