Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is there a preferred/recommended Internet Media Type for RESTful POST requests?

For example, if I want to add a new user, should I send the data as a URL encoded string like:


or does REST recommend I send the data as whatever format the response is going to be sent as (e.g. JSON/XML)?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Typically web services support both XML and JSON based on the user's preference. A lot of people tend to use JSON because it usually allow you to send the same data in a more compact way, which is important for web services(especially if they have mobile clients).

share|improve this answer
add comment

If you can choose, use JSON. It's simple, readable, easily handled both in the server, client or browser's JavaScript, and quick to parse. And is in effect the informal standard for REST. Although XML is usually supported too by most frameworks, there's no reason to use it unless you're somehow forced to. But a URL-like string is definitely not a normal encoding for POST data in REST.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.