I'm trying to write an API that would receive a PDF file, process it, and send the results back to the user within the same request.
I'm confused as for which request should be used for this task, as the user is trying to GET a response from the server, but they also POST a file.
In this case, should/can I add a PDF file as a parameter to the GET request, or should I use a POST request - but if the latter, how does the user get the processed result?
CodePudding user response:
GET
is usually used to get info that is already on the server, while POST
is to send information to the server, and the server responds based on that information.
I think your question should be more focused on whether to use POST
or PUT
. Take a look at this guide, and act according to your case.