curl --request POST \
--url https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneAccountIds": [
"0140a8c6-3815-45b7-9e60-8e137cad845c"
],
"costCenterId": "0198c2f1-3815-45b7-9e60-8e137cad845c"
}
'import requests
url = "https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center"
payload = {
"phoneAccountIds": ["0140a8c6-3815-45b7-9e60-8e137cad845c"],
"costCenterId": "0198c2f1-3815-45b7-9e60-8e137cad845c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phoneAccountIds: ['0140a8c6-3815-45b7-9e60-8e137cad845c'],
costCenterId: '0198c2f1-3815-45b7-9e60-8e137cad845c'
})
};
fetch('https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center', 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://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phoneAccountIds' => [
'0140a8c6-3815-45b7-9e60-8e137cad845c'
],
'costCenterId' => '0198c2f1-3815-45b7-9e60-8e137cad845c'
]),
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.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center"
payload := strings.NewReader("{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}"
response = http.request(request)
puts response.read_body{
"taskId": "0f9c1b2e-5d3a-4f8b-9c7e-1a2b3c4d5e6f"
}{
"code": "idempotency-parameters-mismatch-error",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "forbidden",
"message": "<string>"
}{
"code": "resource-not-found",
"message": "<string>"
}{
"code": "payload-too-large",
"message": "<string>"
}{
"code": "input-validation-error",
"message": "<string>",
"details": [
{
"key": "<string>",
"message": "<string>"
}
]
}{
"code": "too-many-attempts",
"message": "<string>"
}{
"code": "unknown",
"message": "<string>"
}Alterar centro de custo em lote
Aplica um centro de custo a várias linhas de uma vez. A requisição é aceita por inteiro ou recusada por inteiro: se alguma linha ou o centro de custo não pertencer à sua empresa, nada é alterado. As linhas são atualizadas em segundo plano; a resposta traz o ID de uma tarefa para acompanhar o resultado em GET /tasks/.
curl --request POST \
--url https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phoneAccountIds": [
"0140a8c6-3815-45b7-9e60-8e137cad845c"
],
"costCenterId": "0198c2f1-3815-45b7-9e60-8e137cad845c"
}
'import requests
url = "https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center"
payload = {
"phoneAccountIds": ["0140a8c6-3815-45b7-9e60-8e137cad845c"],
"costCenterId": "0198c2f1-3815-45b7-9e60-8e137cad845c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phoneAccountIds: ['0140a8c6-3815-45b7-9e60-8e137cad845c'],
costCenterId: '0198c2f1-3815-45b7-9e60-8e137cad845c'
})
};
fetch('https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center', 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://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phoneAccountIds' => [
'0140a8c6-3815-45b7-9e60-8e137cad845c'
],
'costCenterId' => '0198c2f1-3815-45b7-9e60-8e137cad845c'
]),
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.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center"
payload := strings.NewReader("{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salvy.com.br/api/v3/phone-accounts/batch-update-cost-center")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phoneAccountIds\": [\n \"0140a8c6-3815-45b7-9e60-8e137cad845c\"\n ],\n \"costCenterId\": \"0198c2f1-3815-45b7-9e60-8e137cad845c\"\n}"
response = http.request(request)
puts response.read_body{
"taskId": "0f9c1b2e-5d3a-4f8b-9c7e-1a2b3c4d5e6f"
}{
"code": "idempotency-parameters-mismatch-error",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "forbidden",
"message": "<string>"
}{
"code": "resource-not-found",
"message": "<string>"
}{
"code": "payload-too-large",
"message": "<string>"
}{
"code": "input-validation-error",
"message": "<string>",
"details": [
{
"key": "<string>",
"message": "<string>"
}
]
}{
"code": "too-many-attempts",
"message": "<string>"
}{
"code": "unknown",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Idempotency key for this request. Will return the same response if the same request is made again with the same key. Fails if parameters are different.
Body
IDs das linhas que recebem o centro de custo, até 1.000 por requisição. Todas devem pertencer à sua empresa; se alguma não pertencer, nenhuma é alterada. IDs repetidos são considerados uma vez.
1 - 1000 elements["0140a8c6-3815-45b7-9e60-8e137cad845c"]
ID do centro de custo aplicado às linhas; consultável em GET /cost-centers. Envie null para remover o centro de custo das linhas.
"0198c2f1-3815-45b7-9e60-8e137cad845c"
Response
ID da tarefa que aplica a alteração; acompanhe o resultado em GET /tasks/{id}.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"0f9c1b2e-5d3a-4f8b-9c7e-1a2b3c4d5e6f"