Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Integration of odata Api
Finance forum
Suggested answer

Integration of odata Api

Posted on by 10

Hi,

I am trying to use the d365 F&O APIs to pull the Data entities data. I have followed the instructions to get the access token using oauth flow. I have an app in azure directory. I am able to get the access token. But when I try to hit the odata APIs with that token, it gives me 401 Unauthorised. I don't know what I have been doing wrong. I followed the instructions but could not get APIs working. Any help would be appreciated.

Let me know if you guys need any other information.

Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: Integration of odata Api

    Moved to D365 Finance forum.

    I recommend you to check out the Integration Sample app from Microsoft. It has an OData console app sample as well.

    It's a fully functional solution which you can debug and also use as a documentation.

    And you can use it to determine if your problem is in your AAD app registration or in your code (or both).

    github.com/.../Dynamics-AX-Integration

  • Martin Dráb Profile Picture
    Martin Dráb 225,490 Super User on at
    RE: Integration of odata Api

    I suggest that you don't implement it by yourself at all - use the authentication utility provided by Microsoft as a part of sample integration applications on GitHub.

  • rajatkonigle Profile Picture
    rajatkonigle 10 on at
    RE: Integration of odata Api

    i have gone through every possible documentation present there, nothing worked. I am not sure why i am getting 00000002-0000-0000-c000-000000000000 in aud. They dont talk about this in the doc you mentioned. How do i inspect what is causing these values in jwt. I followed this to get the token , docs.microsoft.com/.../v1-protocols-oauth-code

    Can you let me know if this is way to get the token to access OData APIs. Or i am using wrong doc to get the token.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
  • rajatkonigle Profile Picture
    rajatkonigle 10 on at
    RE: Integration of odata Api

    I have done everything you mentioned. However when i tries to debug my jwt token, in the "aud" part, i got this {"aud": "00000002-0000-0000-c000-000000000000", ...} which does not seem to be correct, any idea why? also i dont have "upn" in my jwt token info. Maybe the access token is not valid, but not sure why.

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,274 on at
    RE: Integration of odata Api

    First of all try to connect via postman docs.microsoft.com/.../third-party-service-test to confirm that settings are correct. IF you cannot, check that you added application id to FnO and mapped to a user, also check that url is correct, somethims you may have trailing slash in the url.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans