PUT

mailing-lists/{id}

Update a specific Contacts List

Variable name

Validation rules

Description

name

string

Name of the mailing list

detail

nullable | string

Description of the mailing list

Request example:

{
"name": "Renamed list"
}

Response example:

  • Status code: 200 OK

{
"success": true,
"data": {
"id": 47,
"organization_id": 8,
"name": "Renamed list",
"detail": null,
"created_at": "2020-11-27 09:48:44",
"updated_at": "2021-01-07 11:02:04",
"used_default_columns": [
"email"
],
"used_custom_columns": [],
"entry_number": 2,
"upload_in_progress": false,
"subscribed_entry_number": 2,
"custom_fields": [],
"unsubscribed": 0,
"bounced": 0
}
}
  • Status code: 400 Bad request

{
"success": false,
"message": "No valid fields given",
"status_code": 400
}
  • Status code: 401 Unauthorized

{
"success": false,
"message": "This mailing list does not belong to your organization",
"status_code": 401
}

Code example:

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '.../mailing-lists/47', //replace ... with the whole API url
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"name": "New name",
"detail": "New detail"
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: YOUR-API-KEY', //replace with your generated API key
'Content-Type: application/json'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Did this answer your question?