thorning / node-mailchimp

node mailchimp wrapper using v3 of the mailchimp api
MIT License
288 stars 35 forks source link

PUT method error header : The requested method and resource are not compatible #66

Closed damienromito closed 4 years ago

damienromito commented 4 years ago

The method mailchimp.post() is ok. But if i decide to change the method to mailchimp.put(), it returns error :

mailchimp err Error: The requested method and resource are not compatible. See the Allow header for this resource's available methods.

I don't understand because parameters are exactly the same.


var Mailchimp = require('mailchimp-api-v3')
var mailchimpListId = "xxxxx"
var mailchimpApiKey = "xxxx"
var mailchimp = new Mailchimp(mailchimpApiKey);

   var mailchimpData = {
        email_address: user.email,
        status: "subscribed",
        "merge_fields": {
          "FNAME": user.firstName,
           ....
        } 
      }

 mailchimp.put(`/lists/${mailchimpListId}/members`, mailchimpData)
thorning commented 4 years ago

There is no PUT endpoint there as far as i can tell https://mailchimp.com/developer/reference/lists/list-members/ To update,you need the subscriber hash as well