如果针对特定列的值不存在于数据库中,状态代码应该是什么?
What should be the status code if the value is not present in DB against the particular column?
我输入了API,它将根据用户名修改用户城市。'api/v1/user/modify_city'
。在请求正文中,我输入了 JSON.
{
'name':'Jhon',
'city': 'NY'
}
我想根据 'Jhon' 用户名将城市修改为 'NY' 但数据库中不存在用户名 jhon,所以在这种情况下我应该 return 状态代码?
在这种情况下,标准 HTTP 状态代码是 404。
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
有些项目使用不同的约定,在这种情况下,本地约定必须优先。
我输入了API,它将根据用户名修改用户城市。'api/v1/user/modify_city'
。在请求正文中,我输入了 JSON.
{
'name':'Jhon',
'city': 'NY'
}
我想根据 'Jhon' 用户名将城市修改为 'NY' 但数据库中不存在用户名 jhon,所以在这种情况下我应该 return 状态代码?
在这种情况下,标准 HTTP 状态代码是 404。
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
有些项目使用不同的约定,在这种情况下,本地约定必须优先。