The /contactslist/{list_ID}/managemanycontacts resource allows you to add, remove or unsubscribe multiple contacts to / from a list. This resource is asynchronous and will return a JobID, which you can use to monitor the process.
If you are specifying Properties for a contact, please note that these properties must already be defined using the /contactmetadata resource. To delete the custom contact data for a specific contact, set the value of the contact property to null.
If a contact has already been added to your contacts or a list, duplicate entries or subscriptions will NOT be created. However, the Properties and Name of the contact will be updated with any modified values.
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactslist/$list_ID/managemanycontacts \
-H 'Content-Type: application/json' \
-d '{
"Action":"addnoforce",
"Contacts":[
{
"Email":"passenger@mailjet.com",
"IsExcludedFromCampaigns":"false",
"Name":"Passenger 1",
"Properties":"object"
}
]
}'{
"Count": 1,
"Data": [
{
"JobID": 54321
}
],
"Total": 1
}Use the JobID returned in the response of the POST /contactslist/{list_ID}/managemanycontacts request to follow the upload process. Do this with GET /contactslist/{list_ID}/managemanycontacts/{job_ID}:
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contactslist/$list_ID/managemanycontacts \{
"Count": 1,
"Data": [
{
"ContactsLists": [
{
"ListID": 987654321,
"Action": "addnoforce"
}
],
"Count": 1,
"Error": "",
"ErrorFile": "",
"JobEnd": "2018-01-01T00:00:00",
"JobStart": "2018-01-01T00:00:00",
"Status": "Completed"
}
],
"Total": 1
}