无法通过MailChimp API 3.0包装器获取Java Maleorang的数据 - 404错误

时间:2016-10-12 09:33:08

标签: java integration mailchimp

我尝试使用MailChimp API 3.0 for Java - Maleorang

我在pom.xml中添加了依赖

   <dependency>
                <groupId>com.ecwid</groupId>
                <artifactId>maleorang</artifactId>
                <version>${maleorang.version}</version>
</dependency>

创建代码示例

  @Test
    public void RunMailChimp() throws Exception {
        MailchimpClient client = new MailchimpClient(MailChimpConstant.API_KEY);
        try {
            EditMemberMethod.CreateOrUpdate method = new EditMemberMethod.CreateOrUpdate(list_id, email);
            method.status = "subscribed";
            method.merge_fields = new MailchimpObject();
            method.merge_fields.mapping.put("FNAME", "***");
            method.merge_fields.mapping.put("LNAME", "***");

            MemberInfo member = client.execute(method);
            System.err.println("The user has been successfully subscribed: " + member);

   GetMembersMethod method = new GetMembersMethod(list_id);
    client.execute(method);

        } finally {
            client.close();
        }
    }

但我收到错误404

INFO: Request: PUT https://us14.api.mailchimp.com/3.0/lists/383444/members/8fb34d6f0c83fe617c0c45ce90b1a1096
Body: {"status":"subscribed","merge_fields":{"FNAME":"***","LNAME":"***"},"email_address":"****@mail.ru"}
окт 12, 2016 12:03:40 PM com.ecwid.maleorang.MailchimpClient execute
INFO: Response: 404 Not Found
Body: {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Resource Not Found","status":404,"detail":"The requested resource could not be found.","instance":""}
com.ecwid.maleorang.MailchimpException: API Error (404): The requested resource could not be found.

链接https://us14.api.mailchimp.com/3.0/lists/383444/members/8fb34d6f0c83fe617c0c45ce90b1a1096,h_t_t_p_s: / / _ us14.api.mailchimp.com/3.0/lists/38341/members哪个生成方法也无法在浏览器中打开(404错误)

谢谢!

1 个答案:

答案 0 :(得分:0)

需要使用列表中的列表ID - >设置 - &gt;列表的唯一ID。来自网址的列表ID。