Help

Calling the Mailchimp API using fetch

Topic Labels: Automations
Solved
Jump to Solution
861 2
cancel
Showing results for 
Search instead for 
Did you mean: 
June_Lau
4 - Data Explorer
4 - Data Explorer

I am getting a 503 response from Mailchimp API when making a simple GET request.

The same request from Postman works. Any ideas why we get a 503?

Thanks!

1 Solution

Accepted Solutions

i’m doing something like this:

let activity = await fetch(`https://${MAILCHIMP_SERVER_PREFIX}.api.mailchimp.com/3.0/lists/${LIST_ID}/members/${allMembers[i].id}/activity?action=unsub,open,click`, {
    method: 'GET',
    headers: {
      "Authorization": `${MAILCHIMP_API_KEY}`
    }
  });

As I type this out, I’m painfully aware that I’ve missed out the word “Bearer” in my authorization header.

Thanks for your message though! hope this helps someone else out there…

See Solution in Thread

2 Replies 2

Welcome to the community, @June_Lau! :grinning_face_with_big_eyes:

My gut tells me that it’s not actually the exact same request if it works one environment and not in another. Typically the environment changing doesn’t have a dramatic affect on the success or failure of an API call.

Would you mind sharing more details about how you’re attempting to call the API? Actual code from your tests would be most helpful (feel free to replace your API key with something else, of course).

i’m doing something like this:

let activity = await fetch(`https://${MAILCHIMP_SERVER_PREFIX}.api.mailchimp.com/3.0/lists/${LIST_ID}/members/${allMembers[i].id}/activity?action=unsub,open,click`, {
    method: 'GET',
    headers: {
      "Authorization": `${MAILCHIMP_API_KEY}`
    }
  });

As I type this out, I’m painfully aware that I’ve missed out the word “Bearer” in my authorization header.

Thanks for your message though! hope this helps someone else out there…