Mettre à jour une liste
curl --request PUT \
--url https://api.wachap.com/v1/contact-groups/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"csvUrl": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups/{id}"
payload = {
"name": "<string>",
"csvUrl": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'csvUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/contact-groups/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"csvUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Listes de contacts
Mettre à jour une liste
Modifiez les métadonnées d’une liste de contacts
PUT
/
contact-groups
/
{id}
Mettre à jour une liste
curl --request PUT \
--url https://api.wachap.com/v1/contact-groups/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"csvUrl": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', csvUrl: '<string>'})
};
fetch('https://api.wachap.com/v1/contact-groups/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/contact-groups/{id}"
payload = {
"name": "<string>",
"csvUrl": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/contact-groups/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'csvUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/contact-groups/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"csvUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Endpoint
/v1/contact-groups/:id
Headers
Bearer token avec votre Secret Key (format:
Bearer sk_...)URL Parameters
L’identifiant de la liste
Body Parameters
Tous les paramètres sont optionnels. Seuls les champs fournis seront mis à jour.| Paramètre | Type | Description |
|---|---|---|
name | string | Nouveau nom de la liste |
csvUrl | string | Nouvelle URL du CSV source |
Exemples de requêtes
curl -X PUT https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"name": "Clients VIP 2024"
}'
const response = await fetch('https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345', {
method: 'PUT',
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "Clients VIP 2024"
})
});
const data = await response.json();
console.log(data);
Exemple de réponse
{
"success": true,
"list": {
"$id": "65f1234567890abcdef12345",
"userId": "user_xxx",
"name": "Clients VIP 2024",
"csvUrl": null,
"status": "ready",
"createdAt": "2024-03-15T10:00:00.000Z",
"updatedAt": "2024-03-16T14:30:00.000Z"
}
}
Note importante
Cette opération ne modifie que les métadonnées de la liste. Les contacts existants ne sont pas affectés.Codes d’erreur
| Code | Description |
|---|---|
401 | INVALID_SECRET_KEY - Clé secrète invalide |
404 | Liste non trouvée |
500 | UPDATE_CONTACT_GROUP_ERROR - Erreur lors de la mise à jour |
⌘I
