user16328756
user16328756

Reputation: 1

API to get foreign exchange rates from partner center

We are attempting to use the API call detailed from https://learn.microsoft.com/en-us/partner/develop/get-foreign-exchange-rates to get foreign exchange rates and have followed the prerequisites for setting up an App Registration with the correct permissions and access.

we are getting aad token, after that use that token to get new token from partner center,

we can use this token for all other partner center api's except for https://api.partner.microsoft.com/v1.0/sales/fxrates(Month='201909')/$value

where we are getting this error: { "statusCode": 401, "message": "Unauthorized: Invalid Authorization header" }

can someone please advice what can be the problem, thanks.

Upvotes: 0

Views: 630

Answers (1)

gordon
gordon

Reputation: 41

You might have solved this by now, but in case not I hit the same problem recently.

There seem to be two sets of Partner Center APIs - api.partnercenter.microsoft.com, and api.partner.microsoft.com

I think you have a bearer token for the 'partnercenter' ones, but the API you're trying to call is a 'partner' one.

I had to add the permission to the web-app I was using for authentication - see https://learn.microsoft.com/en-us/partner/develop/api-authentication That page shows adding both of the API resources, you'll probably have one of them already and be missing the other. I ended up with two APIs registered in the web-app - "Microsoft Partner" and "Microsoft Partner Center".

I was then able to use a refresh token to get bearer tokens for each set of API resources - specifying a resource of https://api.partnercenter.microsoft.com or https://api.partner.microsoft.com as applicable. I'm not sure if it's possible to have one bearer token for both - I've certainly not managed to do so.

Upvotes: 4

Related Questions