I have implemented POST /orders and GET /orders/{id} APIs successfully. Now I want to create one search API.
My resource has the following fields: customerId, orderId, customerName, orderName, and orderType.
I want to create one more get APIs based on fields present in resource. So, I designed it like: GET /orders?orderType=ABC&customerName=Xyz
But I want to restrict search on some params. In the above case say I want to restrict search on orderName (although the field does exist).
Now if you hit GET /orders?orderName=DEF I will respond back with search not supported.
What should the HTTP status code be in this case?
I am concerned about using 501, as this is more related to HTTP status itself. Same for 422, it is related to the entity coming in the request code. Can't send 404 as data does exist. Need some clarity on these.
And what should I finally implement?