Doria ILG
Doria ILG

Reputation: 11

How to retrieve ID of a list in Mailjet?

please how can i retrieve the ID of the list to add a contact in it , the same for the contact how can i know the ID of a contact to add it to a list . Can you please answer to me fastly . Best regards ,

Upvotes: 0

Views: 1141

Answers (2)

nico_lrx
nico_lrx

Reputation: 290

There is also an "ID" column in your contact lists dashboard: https://app.mailjet.com/contacts

Upvotes: 0

Swooop
Swooop

Reputation: 21

To retrieve the ID of contactlists in the system, send an HTTP GET request to:

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

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

The JSON returned from the server will contain your lists, including the ID in this format:

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

To get the ID of a contact, you can use the Contact endpoint of the API and specify by email:

https://api.mailjet.com/v3/REST/contact/[email protected]

curl -X GET --user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" https://api.mailjet.com/v3/REST/contact/[email protected]

This will return the following:

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

You can find the developer documentation at http://dev.mailjet.com

Hope that helps!

Upvotes: 1

Related Questions