PATCH / contact-groups/update
Base URL: https://backend.easify.app/api/v2
This endpoint is used to update a contact group.
The user can update the contact group with a new name or make corrections to the existing name.
There is a rate limit of 60 requests per minute. If you exceed this limit, you will receive a 429 Too Many Requests status, along with a message indicating when you can try again.
Authentication
The Easify API token used for authentication is passed in the header as a Bearer token, which can be obtained from the easify app under Settings > API Settings.
Headers
Authorization string required Bearer << YOUR_EASIFY_API_TOKEN_HERE >>
Query Parameters
name string | Specify the name for the contact group | required |
group_id integer | The specific contact group ID for update (The group ID will be obtained from the contact-groups API response) | required |
Sample Params and Success Response
Params:
{
"group_id": 1,
"name": "Updated Contact Group Name"
}
Success Response:
{
"status": true,
"message":
"Contact Group updated successfully",
"data": {
"id": 1,
"name": "Updated Contact Group Name ",
"contacts_count": 0,
"shared_group": false,
"default_group": false,
"created_at": "09-05-2024 07:27:18 AM"
}
}
- The contacts_count in the response refers to the total number of contacts in the specific contact group.
- The shared_group is a Boolean field that specifies whether the contact group is the main user's shared contact group or not.
- The default_group is a Boolean field that indicates whether the contact group is the user's default contact group in the Easify app
Responses
Case | Status Code | Response |
---|---|---|
If the user does not provide a token in the header or provides an invalid token | 401 |
{
"status":false,
|
If the user provides the name of an existing contact group | 422 |
{
"message": "The name has already been taken.",
"errors": {
"name": ["The name has already been taken."]
}
}
|
If user did not provide the group_id | 422 |
{
"message": "The group id field is required.","errors": {
group_id": "The group id field is required."]
}
}
|
If user did not provide invalid group_id | 400 |
{
"status": false,
"message": "Invalid group id",
"errors": []
}
|
If the user exceeds the allowed rate limit for requests | 429 |
{
"status":false,
"message":"Too many requests. Try again in 59 seconds",
"errors":[]
}
|
If the user's subscription has ended | 402 |
{
"status":false,"message":"You need to recharge your account to proceed","errors":[]
}
|
If the user does not have an enterprise plan | 403 |
{
"status": false,
"message": "Access denied. Your current plan does not allow access to this feature. Please upgrade to the Enterprise plan.",
"errors": []
}
|
PHP-cURL
php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://backend.easify.app/api/v2/contact-groups/update?name=Easify%20Group%20Updated&group_id=2116',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer 1955|43da5bb5-5c2b-4059-a4de-d44bf5c****'
],
]
);
$response = curl_exec($curl);
curl_close($curl);
echo $response;