api-v2 icon indicating copy to clipboard operation
api-v2 copied to clipboard

Document all possible Id's and Message for API errors/unsuccessful's scenarios

Open jeevatkm opened this issue 9 years ago • 5 comments

Documentation doesn't reflect the v2 API behavior. Which is correct one?

As per document

HTTP/1.1403 Forbidden
{
  "error":       "forbidden",
  "description": "You do not have access for the attempted action."
}

My v2 API client development interaction/testing


Http Code 404: This is for incorrect REST resource URL scenario
{
    "id": "not_found",
    "message": "The resource you were accessing could not be found."
}

http code 422: This is for unique name exception while domain creation
{
  "id":"unprocessable_entity",
  "message":"Name has already been taken"
}

Http Code 401: This is for incorrect token & read-only access token performing write operation
 {
   "id":"unauthorized",
   "message":"Unable to authenticate you."
}
  • First thing response structure is incorrect as per document
  • _For read-only access token performing write operation:_ I should be getting 403 with message; either one format. But API is responding with Http code 401 & saying unauthorized.

jeevatkm avatar Aug 03 '14 22:08 jeevatkm

+1

bob-rove avatar Aug 04 '14 06:08 bob-rove

Agreed, will do.

brookemckim avatar Aug 04 '14 15:08 brookemckim

Possible duplicate of https://github.com/digitaloceancloud/api-v2/issues/37

ivanvanderbyl avatar Aug 04 '14 15:08 ivanvanderbyl

For read-only access token performing write operation: I should be getting 403 with message; either one format. But API is responding with Http code 401 & saying unauthorized.

is the bit that overlaps with #37. I want to leave both of them open and just have this one focus on correctly documenting the error messages. The 401 versus 403 is an issue internal to our implementation of oauth.

brookemckim avatar Aug 04 '14 15:08 brookemckim

:+1:

reynir avatar Nov 04 '14 18:11 reynir