如何在Mailjet中检索列表的ID?

时间:2015-04-01 14:17:53

标签: mailjet

请如何检索列表的ID以在其中添加联系人,对于联系人同样如何知道联系人的ID以将其添加到列表中。你能快点回答我吗? 最好的问候,

2 个答案:

答案 0 :(得分:1)

要检索系统中联系人列表的ID,请将HTTP GET请求发送到:

https://api.mailjet.com/v3/REST/contactslist/

curl -X GET --user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" https://api.mailjet.com/v3/REST/contactslist

从服务器返回的JSON将包含您的列表,包括以下格式的ID:

{
  "Address": "",
  "CreatedAt": "2014-06-10T09:11:15Z",
  "ID": 2,
  "IsDeleted": false,
  "Name": "TestList",
  "SubscriberCount": 1
},

要获取联系人的ID,您可以使用API​​的Contact端点并通过电子邮件指定:

https://api.mailjet.com/v3/REST/contact/johnsmith@example.com

curl -X GET --user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" https://api.mailjet.com/v3/REST/contact/johnsmith@example.com

这将返回以下内容:

{"Count": 1,"Data": [
{
  "CreatedAt": "2014-06-10T13:24:05Z",
  "DeliveredCount": 24,
  "Email": "johnsmith@example.com",
  "ID": 3,
  "IsOptInPending": false,
  "IsSpamComplaining": false,
  "LastActivityAt": "2015-02-06T10:01:17Z",
  "LastUpdateAt": "2014-06-10T13:24:05Z",
  "Name": "",
  "UnsubscribedAt": "",
  "UnsubscribedBy": ""
}], "Total": 1 }

您可以在http://dev.mailjet.com

找到开发者文档

希望有所帮助!

答案 1 :(得分:0)

联系人列表仪表板中还有一个“ ID”列:https://app.mailjet.com/contacts