Answer the question
In order to leave comments, you need to log in
What is the ideology of uploading files when working with the REST API?
Let's say we have a RESTful API and we're editing a user entity.
If I want to change the user's avatar, how should the interaction with the API be ideologically correct?
One PUT/PATCH request per /user with image transfer? - after all, we are changing the essence of the user.
or
two requests. First POST to create a picture, then POST / PATCH to change the user and bind a new avatar to him?
The second option seems to me more REST, but it involves two ajax requests instead of one.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question