J
J
JustAHate2016-03-25 11:05:40
RESTful API
JustAHate, 2016-03-25 11:05:40

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

1 answer(s)
K
Klein Maximus, 2016-03-25
@JustAHate

Can't you send a POST to something like /user/:id/logo?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question