1 thought on “REST Service

  1. Ourhints says:

    Yes, REST resource may return either XML or JSON depending upon the request, you can choose below ways to decide which to return,

    • If an extension has been added to the coming REST request (GET **.json or GET **.xml), use that as the requested format.
    • If an Accept header is set, use that header’s value as the requested format e.g. Accept:application/xml or Accept:application/json
    • If there is a request body (as in the case of a POST), and the Content-Type header specifies JSON or XML, use that.
    • Use a default format if none of the above apply (generally use JSON as your default unless your customers are generally still using XML).

Leave a Reply

Your email address will not be published. Required fields are marked *