Which HTTP Response Code to use when Resources have not been send to the server in a previous request?

16 Views Asked by At

I currently am designing an API that will process some files. For the sake of simplicity, lets say I want to send some files to my API, and then start the processing of those files. My process looks like follows:

I first create a session with the request to the endpoint /initsession. Then I can send some files to the server with /files/deposit, this can happen a number of times, but it has at least to happen once. Finally I can trigger the processing of all the files he has deposited earlier by calling /files/startprocessing. The latter two requests have the sessionId obtained by the initsession-call in their request header for authentication.

In my deposit endpoint the files are associated with the session and are persisted on a drive, so they can be used at a later time.

Now I am implementing the exception for the case, that the process is started by the user, but he has not deposited any files yet. I cannot just accept this case and expect the user of my API to deal with the consequences later, but he has to adress this issue immediately.

So the question is, which code to return? In my mind, both 404 Not found as well as 409 Conflict makes sense here. However, from what I've read, 404 seems to be used with mostly static resources, not dynamically uploaded ones.

0

There are 0 best solutions below