Does it send JSON attributes in a POST / PUT request that violates REST?

TL; DR : PUT /users/1 with user="{name: 'John'}" , unlike user[name]="John" , OK?

I love REST. I recently discovered that I store a lot of my data in client-side JavaScript objects. They seem to convert them into parameter forms like

user[name] = "John", user[login] = "jdoe"

superfluous freak, because they will simply be restored on the server somehow like

{user: {name: 'John', login: "jdoe"} }

Internet tips? Should I make a framework for me? Should I use JSON? Should I use BSON instead, since it saves types like Date? :)

+4
source share
1 answer

As long as the parameters are in the request body (i.e. not sent as request parameters), and the content type is set accordingly, I see no problems with it, RESTfully.

+4
source

Source: https://habr.com/ru/post/1335461/


All Articles