Reputation: 1908
I am building an REST API server with Node.js and jQuery with HTML5,
and there's some routes like
PUT /profile
, PUT /settings
to change the profile datas or the user settings,
but I don't know what type of the data should I send to the REST API server,
should I just send a normal form data like how we send a POST
to the server (when the method is PUT
)
or should I change the form data to json, and send a application/json
via the AJAX?
Upvotes: 1
Views: 188
Reputation: 63
both methods will work fine for you so it all comes down to a matter of personal preference. it's important that you are consistent across all of your APIs. personally i'm always using JSON with application/json IMHO, it's more readable.
Upvotes: 1