function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jyoti NavaleJyoti Navale 

I need an example of sending xml data from salesforce to external server using http post request (Restful API).

Hi, I am learning REST apis, in which I can post a single record but now I want to handle a bulky calls.  Anyone having an example for the same?...I googled it but I am confused about how to want a runinig code if possible. Thanks in advance
Alex TennantAlex Tennant
Does the server you're sending your request to have a documented REST API? Do you know what the request format is for the target server?
Jyoti NavaleJyoti Navale
Till now I have sent data/params for GET/POST/PUT in json format (HttpRequest/HttpResponse)
Alex TennantAlex Tennant
Does your REST endpoint support XML format? Do you know what the format of the XML needs to be?

You can send XML easily by setting the body of your HTTP request to the XML that you want to send.

For example:
HttpRequest req = new HttpRequest();
req.setBody('<some xml here>');