How to get Mailchimp Datacenter name

593 views Asked by At

We have a lambda functions in C# to create campaigns in Mailchimp, the problem I am facing is there could be different Mailchimp accounts for different customers which means the Base API URL could be https://us20.api.mailchimp.com or https://us6.api.mailchimp.com.

Is there a way I can retrieve Mailchimp datacenter names using the access token which I have and thereby set the right value for Base API URL within Lambda functions?

I have tried what is mentioned here https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/ but only see an error

'{"error":"invalid_token","error_description":"Unable to load login and user"}**

1

There are 1 answers

0
CSharped On

You can get mailchimp metadata url from this endpoint

https://login.mailchimp.com/oauth2/metadata

make an HTTP GET request to the above URL with a valid access token sent as request header in this format

Request Header