You need to sign in to do that
Don't have an account?

getting data from webservice link
Hello,
I have a above link, which is link for web service.
I want to get the data from this link.
What are steps to do so using REST
Thanks
https://servicesgateway.com/{version}/rest/{service} <ConfigElement name="cAccount" Url="https://servicesgateway.com/1/rest/searchByName" ContractID="XXXX" UserPrefix="XXXXXXX" UserID="XXXXX" Password="XXXXX" AppID="XXX" Version="1" />
I have a above link, which is link for web service.
I want to get the data from this link.
What are steps to do so using REST
Thanks
You can make use SFDC provided in-biult classes for calling HTTP request -
e.g.
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndpoint('https://servicesgateway.com/1/rest/searchByName');
Blob header = Blob.valueOf(UserId+ ':' + Password);
String authHeader = 'BASIC ' + EncodingUtil.base64Encode(header);
req.setHeader('Authorization', authHeader);
req.setMethod('GET');
HTTPResponse resp = req.send(req);
System.debug(res.getBody());
You need to add 'https://servicesgateway.com' to remote site setting and you can parse the response using XML or JSON.
Please let me know if it heps.
Regrads,
Shashi
All Answers
You can make use SFDC provided in-biult classes for calling HTTP request -
e.g.
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndpoint('https://servicesgateway.com/1/rest/searchByName');
Blob header = Blob.valueOf(UserId+ ':' + Password);
String authHeader = 'BASIC ' + EncodingUtil.base64Encode(header);
req.setHeader('Authorization', authHeader);
req.setMethod('GET');
HTTPResponse resp = req.send(req);
System.debug(res.getBody());
You need to add 'https://servicesgateway.com' to remote site setting and you can parse the response using XML or JSON.
Please let me know if it heps.
Regrads,
Shashi
The request should be sent by the http object as below.
HTTPResponse resp = h.send(req);
Regards,
Dinesh
Regards,
Shashi