通过ajax(iron-ajax,聚合物)检索mailchimp列表详细信息

时间:2016-03-03 18:13:53

标签: javascript ajax polymer mailchimp

我正在尝试调用mailchimp API来显示列表的详细信息,但我无法弄清楚如何发送auth凭据来显示列表。我尝试了一些事情,我不确定我是否走在正确的轨道上。这就是我尝试过的:

<iron-ajax
    auto
    url='https://us3.api.mailchimp.com/3.0/lists/{{listid}}'
    handle-as='json'
    method='get'
    headers='{"Authorization": "Basic base64credentials"}'
    debounce-duration='300'
    last-response='{{json}}'></iron-ajax>


<iron-ajax
    auto
    url='https://us3.api.mailchimp.com/3.0/lists/{{listid}}'
    handle-as='json'
    method='get'
    headers='{"user": "username:apikey"}'
    debounce-duration='300'
    last-response='{{json}}'></iron-ajax>


<iron-ajax
    auto
    url='https://us3.api.mailchimp.com/3.0/lists/{{listid}}'
    handle-as='json'
    method='get'
    headers='{"Authorization": "Basic username:apikey"}'
    debounce-duration='300'
    last-response='{{json}}'></iron-ajax>

1 个答案:

答案 0 :(得分:0)

使用String display = msg.replace(pattern1 + action + pattern2, replaceAction[0]); 功能:

btoa