web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Unable to get response from Dynamics 365 CRM OAuth2.0 API in business central AL extension

(0) ShareShare
ReportReport
Posted on by 25

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

Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans