Ivan Mushketyk
Ivan Mushketyk

Reputation: 8285

Why should a REST service support multiple formats (e.g. XML and JSON)?

Several sources (e.g. here) suggest that a REST service should support several formats.

What are the benefits of this approach?

Wouldn't it just make a service more complicated and harder to support while providing no additional benefits for a customer?

Upvotes: 0

Views: 73

Answers (1)

vels4j
vels4j

Reputation: 11298

My point of view I hope it is not necessary. If you have given both, you are giving flexibility customer to use either XML or JSON.

I would prefer using JSON hence it is more compact and readable - in communication it will be "faster" simply because less data is transferred than XML. If you use XML, customer can use xslt, xpath things. Both has pros and cons.

Upvotes: 1

Related Questions