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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Dynamics365 - Rest API - Credential Access

(0) ShareShare
ReportReport
Posted on by 5

Hello,

 I am trying to build some APIs to populate or update contact records in our CRM. we generated credentials in our Azure AD environment. Were able to use the client/secret keys to generate our bearer token, but the API calls are getting a 401 error. I was hoping you had some insights into what permissions are required for that endpoint credential to access the CRM platform to run Get/Post/Patch calls. When we created the endpoint we had to give it roles/assignments but we weren't sure what exactly to give it. I think this is the root of the 401 error.

Example API is as follows:


customer.crm.dynamics.com/.../contacts

customer.api.crm.dynamics.com/.../candidates

customer.crm.dynamics.com/.../candidates

Hoping to get insights into what are the appropriate roles/responsibilities in AZURE AD to run these types of commands.

Thank you,

Ted Woods

I have the same question (0)
  • Guido Preite Profile Picture
    54,084 Moderator on at
    RE: Dynamics365 - Rest API - Credential Access

    then try if the request works inside Postman, if works inside Postman then contact the support of OneTrust (because the problem looks like not connected to Dynamics). If doesn't work inside Postman it means the Bearer token is not correct.

  • TedWoods1848 Profile Picture
    5 on at
    RE: Dynamics365 - Rest API - Credential Access

    1) Bearer token generates properly

    2) there is prefix ahead of candidates, I was anonymizing our API call.

    Thanks

  • Suggested answer
    Guido Preite Profile Picture
    54,084 Moderator on at
    RE: Dynamics365 - Rest API - Credential Access

    you can use any software you want to call the API, but you have two problems:

    1) the bearer token needs to be valid, and you can verify it with postman

    2) the query to Dynamics needs to be valid, in your example that endpoint I am 99,99% sure that is not valid because "candidates" endpoint does not exists (maybe is prefix_candidates) and for that you can use Dataverse REST Builder to build the query.

    hope it helps

  • TedWoods1848 Profile Picture
    5 on at
    RE: Dynamics365 - Rest API - Credential Access

    I am using OneTrust our Privacy Management Solution:

    HTTP operation failed invoking https://***Customer***.api.crm.dynamics.com/api/data/v9.2/candidates with statusCode: 401

  • Suggested answer
    Guido Preite Profile Picture
    54,084 Moderator on at
    RE: Dynamics365 - Rest API - Credential Access

    are you sure you did all the steps for the clientid-clientsecret? including the assignment of a security role? here you can find a tutorial

    benediktbergmann.eu/.../

    where are you getting the 401 error?

    if inside postman try to generate the request using my tool Dataverse REST Builder and after export the collection to postman, when you export you can set the authentication to your clientid-clientsecret

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 141

#2
DAnny3211 Profile Picture

DAnny3211 134

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 70 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans