[SalesForce] Marketing Cloud REST API “Not Authorized” error in Postman

Am doing a POST REST API call out from Postman to insert a record in Data extension.

Below are the steps:
Step 1:

POST -->  https://s50.auth.marketingcloudapis.com/v1/requestToken 
Body --> {  "clientId" : "*********",   
           "clientSecret" : "*****" }

Am getting a refresh token –> *****.

Step 2:

Authorization –> Bearer Access Token,
Content-Type –> application/json

POST --> https://s50.rest.marketingcloudapis.com/hub/v1/dataevents/key:Test_DE/rowset
Body --> [
              {
                "keys": {
                  "EmailAddress": "Test45678@yopmail.com"
                },
                "values": {
                     "Test":"Test24"

              }
              }
              ]

I have only 2 fields in my Test_DE Data extension which is EmailAddress and Test.

Am getting below error from Postman:

{
    "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm",
    "errorcode": 0,
    "message": "Not Authorized"
}

Please help!!

Best Answer

Try using a different set of URLs to perform the insert operation.

This article about your Your Subdomain and Your Tenant's Endpoints states:

While customers on S1 through S10 can continue to use the legacy endpoints, we recommend that you use the tenant-specific Marketing Cloud endpoints for improved performance

Your URLs show stack 50 (first time I have heard of a stack with such a high number), so it would seem you are forced to use different endpoints.

Go into Administration > Installed Packages and find the installed package you are using to authenticate and send send REST calls. They will be displayed in the components section:

enter image description here

Try using them with your calls.

Related Topic