2017-03-07 159 views
0

我對mailchimp取消訂閱過程有問題。 請您爲我提供取消訂閱程序的方式。如何放入取消訂閱列表以及我應該請求什麼文件。我如何知道電子郵件應放入取消訂閱列表中的差異。mailchimp退訂節點js服務器

mailchimp.post('/lists/{id}', { 
     email_address : "[email protected]" 
    }) 
     .then(function(results) { 
     console.log(results) 
     }) 
     .catch(function (err) { 
     console.log(err) 
     }); 

響應誤差

{ Error: The resource submitted could not be validated. For field-specific details, see the 'errors' array. 
    at Request._callback (/Users/Gizbreht/Desktop/myofer-mailer-express/node_modules/mailchimp-api-v3/index.js:506:30) 
    at Request.self.callback (/Users/Gizbreht/Desktop/myofer-mailer-express/node_modules/request/request.js:187:22) 
    at emitTwo (events.js:106:13) 
    at Request.emit (events.js:191:7) 
    at Request.<anonymous> (/Users/Gizbreht/Desktop/myofer-mailer-express/node_modules/request/request.js:1126:10) 
    at emitOne (events.js:96:13) 
    at Request.emit (events.js:188:7) 
    at IncomingMessage.<anonymous> (/Users/Gizbreht/Desktop/myofer-mailer-express/node_modules/request/request.js:1046:12) 
    at IncomingMessage.g (events.js:291:16) 
    at emitNone (events.js:91:20) 
    at IncomingMessage.emit (events.js:185:7) 
    at endReadableNT (_stream_readable.js:974:12) 
    at _combinedTickCallback (internal/process/next_tick.js:74:11) 
    at process._tickCallback (internal/process/next_tick.js:98:9) 
    type: 'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/', 
    title: 'Invalid Resource', 
    status: 400, 
    detail: 'The resource submitted could not be validated. For field-specific details, see the \'errors\' array.', 
    instance: '', 
    errors: 
    [ { field: '', 
     message: 'Required fields were not provided: members' } ] } 

回答

0
mailchimp.post('/lists/{id}', { 
    "members" : [{"email_address": email, "status": "unsubscribed"}],"update_existing":true 
}) 
.then(function(results) { 
    console.log(results) 
}) 
.catch(function (err) { 
    console.log(err) 
});