今天一个同事的接口突然报409,大概百度了一下,不是很清楚,谷歌也没找到特别好的解释
因为是直接调用的gitlab,就直接看了下gitlab的api
The following table shows the possible return codes for API requests.
Return values | Description |
---|---|
200 OK | The GET , PUT or DELETE request was successful, and the resource itself is returned as JSON. |
202 Accepted | The GET , PUT or DELETE request was successful, and the resource is scheduled for processing. |
204 No Content | The server has successfully fulfilled the request, and there is no additional content to send in the response payload body. |
201 Created | The POST request was successful, and the resource is returned as JSON. |
304 Not Modified | The resource hasn't been modified since the last request. |
400 Bad Request | A required attribute of the API request is missing. For example, the title of an issue is not given. |
401 Unauthorized | The user isn't authenticated. A valid user token is necessary. |
403 Forbidden | The request isn't allowed. For example, the user isn't allowed to delete a project. |
404 Not Found | A resource couldn't be accessed. For example, an ID for a resource couldn't be found. |
405 Method Not Allowed | The request isn't supported. |
409 Conflict | A conflicting resource already exists. For example, creating a project with a name that already exists. |
412 | The request was denied. This can happen if the If-Unmodified-Since header is provided when trying to delete a resource, which was modified in between. |
422 Unprocessable | The entity couldn't be processed. |
429 Too Many Requests | The user exceeded the application rate limits. |
500 Server Error | While handling the request, something went wrong on the server. |
gitlab解释的很清晰,就是说资源已经存在了,再次创建失败
那为什么接口没有将报错message展示出来,查了一下代码是因为直接屏蔽了409状态码,直接用postman访问接口会返回具体错误信息,错误提示信息示例:
示例1:
{
"message": "Email has already been taken"
}
示例2:
{
"message": "Username has already been taken"
}
找gitlab负责人查了下数据,确实是用户已经存在了,但是用户状态是blocked(禁用),问题解决