• SadishK
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi - I'm trying to run this script in my sandbox and getting "SESSION_ID_REMOVED" result
------
String sessionId = UserInfo.getSessionId();
system.debug('--- Session Id Value ---'+sessionId);
------
 
Hey Everyone - I'm trying to pass header info the external API endpoint and using "PageReference" class. I see the documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_System_PageReference_getHeaders.htm) but some reason the header is still not set properly. 

My expectation is the EndPoint URL should be executed without any error screen.

But I'm getting the below error message:
error screen

And here my codeset:
Apex Class: FileDownload
public with sharing class FileDownload {
	public Pagereference doAction() {
        Pagereference newPage = new pagereference('https://<<myDomain>>/api/v1/loanadjudicate/<<externalIdValue>>/file/download');
        newPage.getHeaders().put('Ocp-Apim-Subscription-Key', '<<mySubscriptionKey>>');
        newPage.getHeaders().put('Content-Type', 'text');
        newPage.getHeaders().put('Method', 'GET');
        newPage.setRedirect(false);
        return newPage;
    }
}
VF: DownloadPage
<apex:page controller="FileDownload" action="{!doAction}">

</apex:page>

Any help is appreciated!
 
  • March 18, 2019
  • Like
  • 0
Hi - I'm trying to run this script in my sandbox and getting "SESSION_ID_REMOVED" result
------
String sessionId = UserInfo.getSessionId();
system.debug('--- Session Id Value ---'+sessionId);
------