Skip to content

Instantly share code, notes, and snippets.

@sfdcfanboy
Created January 15, 2018 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfdcfanboy/1eabb61451357a0e19cbf23c0207ccc7 to your computer and use it in GitHub Desktop.
Save sfdcfanboy/1eabb61451357a0e19cbf23c0207ccc7 to your computer and use it in GitHub Desktop.
HTTPRequest feedRequest = new HTTP Request();
feedRequest.setEndpoint('callout:SalesforceNC/services/data/v32.0');
feedRequest.setMethod('GET');
HTTP http = new HTTP();
HTTPResponse feedResponse = http.send(feedRequest);
System.debug(feedResponse.getBody());
@pragya-mishra91
Copy link

pragya-mishra91 commented May 2, 2019

I am trying Named Credential with Password Authentication

HttpRequest req = new HttpRequest();
req.setEndpoint('callout:HTTP_Basic_Credential/services/data/v32.0');
req.setMethod('GET');
Http http = new Http();
HttpResponse res = http.send(req);
System.debug(res.getBody());

This code is giving me below error:

if Generate Authorization Header is checked
[{"message":"INVALID_HEADER_TYPE","errorCode":"INVALID_AUTH_HEADER"}]

if Generate Authorization Header is not checked,then it is giving session expired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment