Saltar para o conteúdo principal
POST
/
v1
/
custom-fields
Criar campo adicional
curl --request POST \
  --url https://api.vendaze.com/v1/custom-fields \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "label": "CPF",
  "key": "cpf_cliente",
  "value": {
    "select_list": [
      {
        "key": "sl_opcao_a",
        "option": "Opção A"
      },
      {
        "key": "sl_opcao_b",
        "option": "Opção B"
      }
    ]
  },
  "required": false,
  "show_people": true,
  "show_companies": false,
  "show_deals": false
}
'
import requests

url = "https://api.vendaze.com/v1/custom-fields"

payload = {
"label": "CPF",
"key": "cpf_cliente",
"value": { "select_list": [
{
"key": "sl_opcao_a",
"option": "Opção A"
},
{
"key": "sl_opcao_b",
"option": "Opção B"
}
] },
"required": False,
"show_people": True,
"show_companies": False,
"show_deals": False
}
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({
label: 'CPF',
key: 'cpf_cliente',
value: {
select_list: [{key: 'sl_opcao_a', option: 'Opção A'}, {key: 'sl_opcao_b', option: 'Opção B'}]
},
required: false,
show_people: true,
show_companies: false,
show_deals: false
})
};

fetch('https://api.vendaze.com/v1/custom-fields', 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.vendaze.com/v1/custom-fields",
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([
'label' => 'CPF',
'key' => 'cpf_cliente',
'value' => [
'select_list' => [
[
'key' => 'sl_opcao_a',
'option' => 'Opção A'
],
[
'key' => 'sl_opcao_b',
'option' => 'Opção B'
]
]
],
'required' => false,
'show_people' => true,
'show_companies' => false,
'show_deals' => false
]),
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.vendaze.com/v1/custom-fields"

payload := strings.NewReader("{\n \"label\": \"CPF\",\n \"key\": \"cpf_cliente\",\n \"value\": {\n \"select_list\": [\n {\n \"key\": \"sl_opcao_a\",\n \"option\": \"Opção A\"\n },\n {\n \"key\": \"sl_opcao_b\",\n \"option\": \"Opção B\"\n }\n ]\n },\n \"required\": false,\n \"show_people\": true,\n \"show_companies\": false,\n \"show_deals\": false\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.vendaze.com/v1/custom-fields")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"CPF\",\n \"key\": \"cpf_cliente\",\n \"value\": {\n \"select_list\": [\n {\n \"key\": \"sl_opcao_a\",\n \"option\": \"Opção A\"\n },\n {\n \"key\": \"sl_opcao_b\",\n \"option\": \"Opção B\"\n }\n ]\n },\n \"required\": false,\n \"show_people\": true,\n \"show_companies\": false,\n \"show_deals\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vendaze.com/v1/custom-fields")

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 \"label\": \"CPF\",\n \"key\": \"cpf_cliente\",\n \"value\": {\n \"select_list\": [\n {\n \"key\": \"sl_opcao_a\",\n \"option\": \"Opção A\"\n },\n {\n \"key\": \"sl_opcao_b\",\n \"option\": \"Opção B\"\n }\n ]\n },\n \"required\": false,\n \"show_people\": true,\n \"show_companies\": false,\n \"show_deals\": false\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "label": "CPF",
    "key": "cpf_cliente",
    "value": {
      "select_list": [
        {
          "key": "sl_opcao_a",
          "option": "Opção A"
        },
        {
          "key": "sl_opcao_b",
          "option": "Opção B"
        }
      ]
    },
    "required": true,
    "show_people": true,
    "show_companies": true,
    "show_deals": true,
    "created_at": "2023-11-07T05:31:56Z"
  }
}
{
"error": {
"code": "bad_request",
"message": "Request body must be valid JSON.",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "unauthorized",
"message": "Missing or invalid Authorization header.",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "insufficient_scope",
"message": "This endpoint requires the 'webhooks:read' scope.",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "conflict",
"message": "A record with this value already exists.",
"fields": {
"key": "Value already in use."
},
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "validation_error",
"message": "Validation failed.",
"fields": {
"url": "url must use HTTPS.",
"events": "At least one event is required."
},
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
{
"error": {
"code": "internal_error",
"message": "An unexpected error occurred.",
"request_id": "550e8400-e29b-41d4-a716-446655440000"
}
}

Autorizações

Authorization
string
header
obrigatório

Access token OAuth 2.1.

Corpo

application/json
label
string
obrigatório

Rótulo do campo.

Required string length: 1 - 40
Exemplo:

"CPF"

key
string
obrigatório

Chave única no workspace. Apenas letras minúsculas, dígitos e underscores entre palavras.

Required string length: 1 - 35
Pattern: ^[a-z0-9]+(_[a-z0-9]+)*$
Exemplo:

"cpf_cliente"

type
enum<string>
obrigatório

Tipo do campo.

Opções disponíveis:
text,
long_text,
select,
multi_select,
cpf,
cnpj,
date,
number,
link,
address
value
object

Opções para tipos select e multi_select. Obrigatório quando type for select ou multi_select. Deve ser omitido para todos os outros tipos de campo.

Exemplo:
{
"select_list": [
{ "key": "sl_opcao_a", "option": "Opção A" },
{ "key": "sl_opcao_b", "option": "Opção B" }
]
}
required
boolean

Se o campo é obrigatório. Padrão: false.

Exemplo:

false

show_people
boolean

Exibir em pessoas. Padrão: true.

Exemplo:

true

show_companies
boolean

Exibir em empresas. Padrão: true.

Exemplo:

false

show_deals
boolean

Exibir em negócios. Padrão: false.

Exemplo:

false

Resposta

Campo criado com sucesso.

data
object