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
Mariappan PerumalMariappan Perumal 

Http Callout Issue

Hi Everyone,


I have created endpoint URL for google analytics,

then how to add remaining attributes in HttpRequest ?

For example,,

HttpRequest req = new HttpRequest();


My Question is how to add remaining attribute that mean like (ids=ga%3A731335) in the same class, and how to call this?

ForceMantis (Amit Jain)ForceMantis (Amit Jain)
Try this way, so you need to set request method to get so that parameter are passed in url and then add name value pair in request body. HTTP class will use these to do http callout.

HttpRequest req = new HttpRequest();

// Specify the required user name and password to access the endpoint
// As well as the header and header information

String username = 'myname';
String password = 'mypwd';

Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' +
req.setHeader('Authorization', authorizationHeader);

// Create a new http object to send the request object
// A response object is generated as a result of the request

Http http = new Http();
HTTPResponse res = http.send(req);
Mariappan PerumalMariappan Perumal

Hi amit,


Nice to hear from you. I tried  this one but unfortantely that was not the answer for this. I mean that was not working.


I am trying to use setheader method to get n no of parameter concat to endpoint to url .I am not sure with that way.


If you know any other way kindly let me know.


Thanks in advance