Skip to content

API Server Response Status

fredchu edited this page May 15, 2012 · 14 revisions

API Server Response Status

Please read the original http 1.1 header status code spec first.

ref:

Header Status Code

We can specified more details in the json response body status feild.

200 OK

  • mostly for get request

201 Created

  • data created.

204 No Content

  • data deleted.
  • record( in the database ) not found.

302 Found

  • request redirect

304 Not Modified

  • from cache

400 Bad Request

  • validation err
  • wrong param format. Ex. wrong _id format or too long.
  • request param missing.

401 Unauthorized

  • need to login
  • user_id & password does not match.
  • user_id & token does not match.

403 Forbidden

  • user has no right to access the resource.

404 Not Found

  • resource not found

409 Conflict

  • duplicate data.
  • validation error - required field should be unique. Ex. email is taken.

412 Precondition Failed

  • request param missing for get only, # deprecated.

500 Internal Server Error

  • some shit happened.