You need to sign in to do that
Don't have an account?
Sadish
Header info in the PageReference not working!
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:
And here my codeset:
Apex Class: FileDownload
Any help is appreciated!
My expectation is the EndPoint URL should be executed without any error screen.
But I'm getting the below error message:
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!
Greetings to you!
Please refer to the below links which might help you further with the above issue.
https://stackoverflow.com/questions/51519687/api-management-url-is-giving-missing-subscription-key-issue
https://stackoverflow.com/questions/42467898/azure-issue-token-api-returning-access-denied-due-to-missing-subscription-key
https://pvandenheede.wordpress.com/2017/07/12/azure-api-management-subscription-key-invalid/
https://www.tech-findings.com/2018/09/access-denied-due-to-missing.html
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Regards,
Sadish