Validation GET API中无效数据与不存在数据的响应

Validation GET API中无效数据与不存在数据的响应,validation,get,restapi,Validation,Get,Restapi,下面是我正在开发的API的签名 GET https://basedomain.com/api/v1/order/{orderid}/items=filter[name]={name} 这里,orderid值将是数据库中表的自动生成主键值 我不知道什么时候应该返回http状态 1. orderid <= 0 (order id is not expected to be <= 0 in the database as it is auto-generated) 2. orderid

下面是我正在开发的API的签名

GET https://basedomain.com/api/v1/order/{orderid}/items=filter[name]={name}
这里,
orderid
值将是数据库中表的自动生成主键值

我不知道什么时候应该返回http状态

1. orderid <= 0 (order id is not expected to be <= 0 in the database as it is auto-generated)
2. orderid which does not exist in the database
我之所以喜欢上面的方法,是因为这里的输入值
orderid
没有像post/put API中通常那样用于在后端进行任何更改
orderid
是一个
resourceid
,它可以存在也可以不存在,并且应该基于此返回响应。响应不应指示后端存储此值的约束

同时,其他开发者也有如下看法

if (orderid <= 0)
    return 400 - Bad Request
else if (order id does not exist in the database)
    return 404 - Not Found
if(orderid
if (orderid <= 0)
    return 400 - Bad Request
else if (order id does not exist in the database)
    return 404 - Not Found