MailChimp API V3 GET

时间:2018-09-07 09:40:02

标签: vba ms-access mailchimp mailchimp-api-v3.0

我正在与MailChimp API v3.0一起使用VBA将小型Access 2016数据库链接到MailChimp中-我正在使用以下代码检查MailChimp上是否存在电子邮件,然后在我已建立的测试清单。但是,它没有返回正确的订阅状态:

Select Case Request
Case Is = "GET"
MailExist = False
MailSub = False
APIString = "search-members?query="
With CreateObject("MSXML2.XMLHTTP")
    .Open Request, APIUrl & APIString & Criteria, False
    .setrequestheader "Authorization", "Basic " & APIAuth
    .send
    APIResponse = .responsetext
    If InStr(APIResponse, "{""exact_matches"":{""members"":[]") > 0 Then
        MailExist = False
        Else
        MailExist = True
        Set JSONControl = CreateObject("MSScriptControl.ScriptControl")
        JSONControl.language = "Jscript"
        APIString = "lists/a0da306709/members/"
        .Open Request, APIUrl & APIString & StringMD5(Criteria), False
        .setrequestheader "Authorization", "Basic " & APIAuth
        .send
        Debug.Print "CONTACT STATUS IS: " & .responsetext; Spc(2)
        Set Subber = JSONControl.Eval("(" + .responsetext + ")")
        If Subber.status = "subscribed" Then
            MailSub = True
            Else
            MailSub = False
        End If
    End If
End With
End Select

以上内容当前在响应文本的正文中返回“ status”:“ subscribed”,但是当我登录MailChimp并查看实际联系人时,其状态为“取消订阅”(我是取消订阅的人)通过API)。我已经检查了MD5哈希值,以确认电子邮件是正确的,并且没有收到MailChimp的任何错误响应,因此对于响应为何将帐户显示为“已订阅”,我感到茫然。 >

0 个答案:

没有答案