Hi ,
Unable to get response or post to Dynamics 365 CRM OAuth2.0 web API with AL code.
I tried with Postman, it is generating request token to get response from API and its working fine,but getting hard time in AL to do that
In Postman :
Headers :
If-None-Match : null
Accept : application/json
Content-Type:application/json
https://test.api.crm4.dynamics.com/api/data/v9.1/accounts(client _id)
I generated request token with Call back url , resource, secret key and it worked
In business central side AL ,I tried like this :
Request URL :
RequestContent.GetHeaders(contentHeaders);
contentHeaders.Remove('Content-Type');
contentHeaders.Add('Content-Type', 'application/json');
contentHeaders.TryAddWithoutValidation('Accept', 'application/json');
RequestMessage.Content := RequestContent;
RequestMessage.SetRequestUri(RequestURL);
RequestMessage.Method := 'GET';
client.Send(RequestMessage, ResponseMessage);
if not ResponseMessage.IsSuccessStatusCode then
Message('Statuscode %1 \' + 'Reason: %2 ', ResponseMessage.HttpStatusCode, ResponseMessage.ReasonPhrase);
end;
Any help??
Thank you in Advance

Report
All responses (
Answers (