2

I have tried the API(/metadata/list) of mailChimp as recommended by the official documentation through postman but always got the same error of Invalid_Key. I have getting key from the mailchimp account and it's active right now. Is anyone know that there is some tricky part to call the MailChimp Api's through postman?

Error Response of Postman:

 {
        "status": "error",
        "code": -1,
        "name": "Invalid_Key",
        "message": "Invalid API key"
        "Status Code: 500
 }

Official MailChimp Documentation Link

And I have tried the mailchimp client transactional nodeJS code as well which is as following but still got same error as thorugh postman.

const mailchimp = require('@mailchimp/mailchimp_transactional')('API-KEY');

async function callPing() {
    const response = await mailchimp.metadata.list();
    console.log(response);
}

callPing();

mailchimp-transactional-node

4
  • Did you add api key for the request ? Could you add what are you sending in postman
    – PDHide
    Commented Dec 10, 2020 at 12:43
  • Sorry, The Api-Key is private thing. So that's why i didn't add on this. Commented Dec 10, 2020 at 12:45
  • This is the api use in postman mandrillapp.com/api/1.0/metadata/list with POST method. Commented Dec 10, 2020 at 12:46
  • Replace key value with something else and just add the screen shot
    – PDHide
    Commented Dec 10, 2020 at 12:47

1 Answer 1

20

Update

  1. you might be using the API key created from Mailchimp and not mandrillapp.

  2. Mandrill is an add on in Mailchimp, so you are authenticating yourself with mandrill and mandrill will authenticate you to Mailchimp account. So you have to create api key from mandrill and not mailchimp.

Step to create the key:

  1. Login to your mailchimp account and click Transaction "try our demo", then you will see below Launch button . Click on it:

enter image description here

  1. Click on continue to mandrill and once you are in mandrillaccount ignore what ever you see on screen. Click on setting and click Add or new api key:

enter image description here

  1. now use this in your request:

enter image description here

old answer

curl -X POST \
  https://mandrillapp.com/api/1.0/metadata/list \
  -d '{"key":""}'

This is the curl for the specific request ,as key is send as body you have to use body>raw>json

And use { "key" : "value"}

You don't have to pass it through authorization.

Postman benefits

In postman this process can be made easy by clicking

Import > using curl and pasting the curl command that is provided as example

It will create the equalent request for you automatically

Generation of code from postman

You can click the link named as code near to the send button, to create code in any language from postman request

4
  • Thank you for your help but got same error. Commented Dec 10, 2020 at 13:20
  • @AbdulMoeez are you doing sure you are doing http post ?
    – PDHide
    Commented Dec 10, 2020 at 13:46
  • @AbdulMoeez added the correect step . You should create mandrill apikey and not mailchimp api key.
    – PDHide
    Commented Dec 10, 2020 at 16:33
  • 1
    Thank's for the response. Yesterday i already got this solution by my own and successfully implemented my solution. Hit vote for this question if you think, it will help the stack overflow community. Commented Dec 11, 2020 at 23:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.