Atualizar uma etiqueta
curl --request PUT \
--url https://{host}/api/{session}/labels/{labelId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "Lead",
"colorHex": "#ff9485",
"color": null
}
'import requests
url = "https://{host}/api/{session}/labels/{labelId}"
payload = {
"name": "Lead",
"colorHex": "#ff9485",
"color": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Lead', colorHex: '#ff9485', color: null})
};
fetch('https://{host}/api/{session}/labels/{labelId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/{session}/labels/{labelId}",
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' => 'Lead',
'colorHex' => '#ff9485',
'color' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{host}/api/{session}/labels/{labelId}"
payload := strings.NewReader("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("apikey", "<api-key>")
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))
}HttpResponse<String> response = Unirest.put("https://{host}/api/{session}/labels/{labelId}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/labels/{labelId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"label": {
"id": "label123",
"name": "Clientes Premium",
"color": 3
}
}
Etiquetas
Atualizar Rótulo
Atualizar nome e cor de um rótulo existente
PUT
/
api
/
{session}
/
labels
/
{labelId}
Atualizar uma etiqueta
curl --request PUT \
--url https://{host}/api/{session}/labels/{labelId} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "Lead",
"colorHex": "#ff9485",
"color": null
}
'import requests
url = "https://{host}/api/{session}/labels/{labelId}"
payload = {
"name": "Lead",
"colorHex": "#ff9485",
"color": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Lead', colorHex: '#ff9485', color: null})
};
fetch('https://{host}/api/{session}/labels/{labelId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{host}/api/{session}/labels/{labelId}",
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' => 'Lead',
'colorHex' => '#ff9485',
'color' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://{host}/api/{session}/labels/{labelId}"
payload := strings.NewReader("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("apikey", "<api-key>")
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))
}HttpResponse<String> response = Unirest.put("https://{host}/api/{session}/labels/{labelId}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/api/{session}/labels/{labelId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Lead\",\n \"colorHex\": \"#ff9485\",\n \"color\": null\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"label": {
"id": "label123",
"name": "Clientes Premium",
"color": 3
}
}
Descrição
Este endpoint permite atualizar as informações de um rótulo existente, como seu nome e cor.Parâmetros de URL
string
required
ID único da sessão WhatsApp
string
required
ID do rótulo a ser atualizado
Corpo da Requisição
string
required
Novo nome do rótulo
number
required
Novo código numérico da cor do rótulo
Resposta
boolean
Indica se o rótulo foi atualizado com sucesso
{
"success": true,
"label": {
"id": "label123",
"name": "Clientes Premium",
"color": 3
}
}
Códigos de Status
200- Rótulo atualizado com sucesso400- Parâmetros inválidos401- Não autorizado404- Rótulo não encontrado
Exemplo de Uso
curl -X PUT https://api.wappfy.com.br/api/my-session/labels/label123 \
-H "Content-Type: application/json" \
-d '{
"name": "Clientes Premium",
"color": 3
}'
const session = 'my-session';
const labelId = 'label123';
const response = await fetch(`https://api.wappfy.com.br/api/${session}/labels/${labelId}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Clientes Premium',
color: 3
})
});
const data = await response.json();
console.log(data);
import requests
session = 'my-session'
label_id = 'label123'
response = requests.put(
f'https://api.wappfy.com.br/api/{session}/labels/{label_id}',
json={
'name': 'Clientes Premium',
'color': 3
}
)
data = response.json()
print(data)
Authorizations
Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)
Path Parameters
Body
application/json
