In our Organization, the items in our inventory are called
stocks. Eachstockhas asortScoreassociated with it. An internal API is exposed to another team in the organization to update the sortScore of thestock.
PUT /api/stock/{stockid}/sortscore
This request updates the sortScore of the stock. It may happen that the stock is no more
live(it is sold), but for some reason, the internal API for updating the sortScore is still hit by another team.According to me, here the resource is
sortScoreand the parent resource is thestock, which isn't live anymore(It used to be live at some point of time). Even though the stock is no morelive, we still keep a record of it somewhere in our Database.Some of us are having arguement about the HTTP Status code we are sending when the
stock is not live anymore. Since the resource is not available at the intendedResource Identifier(URL), we are sending NOT FOUND. But some of our colleagues are saying that since the stock used to be live at some point of time, theStatus Codeshould be of 2xx series with the message thatThis stock is not live anymore.Now I am here to know what the people from
stackoverflowthinks about what the correct answer should be?
Aucun commentaire:
Enregistrer un commentaire