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
ArunaAruna 

Send URL parameters to external system instead of JSON file.

Hello there,

When record manually deleted in salesforce send that record id to other system as URL parameter.
I know it is asynchronous process with @future(callout=true).
I was looking at the HttpRequest  API document I did not find the method to set parameters and send to as request.
instead of sending JSON file in the body send as URL parameter.
Can anyone suggest me how can I send URL parameters to other systems using HttpRequest .

Thank you.



 
Best Answer chosen by Aruna
Pankaj MehraPankaj Mehra
Hi Aruna,

You can add the parameter in the URL:

String URL = "http://xxx.com?deleteId=" + recordId;
request.setEndpoint(URL);

OR 

String endpoint = 'http://www.example.com/service';
String body = 'deleteId='+deleteId+'&param2=param2&param3=param3';
HttpRequest req = new HttpRequest();
req.setEndpoint(endpoint);
req.setMethod('POST');
req.setbody(body);
Http http = new Http();
HTTPResponse response = http.send(req);

Thanks