I was trying to create entity using Web API. So using my instance url, client_id, client_secret I can successfully generate access token and refresh token. But whenever I try to make any post request using that access_token, I get 401(unauthorized) status.
I was trying to create new entity from postman like this:
url: https://myurldomain.crm5.dynamics.com/api/data/v9.0/accounts
headers:
POST /api/data/v9.0/accounts HTTP/1.1
Host: myinstancename.crm5.dynamics.com
Content-Type: application/json; charset=utf-8
Authorization: Bearer mytoken
OData-Version: 4.0
OData-MaxVersion: 4.0
Accept: application/json
[copied from postman code section]
Body:
{
"name": "Sample Account",
"creditonhold": false,
"address1_latitude": 47.639583,
"description": "This is the description of the sample account",
"revenue": 5000000,
"accountcategorycode": 1
}
While send request, I constantly get 401 unauthorized response. Any suggestion please? I am following their API