Create a new supplier
curl --request POST \
--url https://api.example.com/suppliers \
--header 'Content-Type: application/json' \
--data '
{
"name": "Fornecedor A",
"corporateName": "Fornecedor A LTDA",
"document": "12345678000199",
"email": "contato@fornecedor.com",
"phone": "11999999999",
"active": true
}
'import requests
url = "https://api.example.com/suppliers"
payload = {
"name": "Fornecedor A",
"corporateName": "Fornecedor A LTDA",
"document": "12345678000199",
"email": "contato@fornecedor.com",
"phone": "11999999999",
"active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Fornecedor A',
corporateName: 'Fornecedor A LTDA',
document: '12345678000199',
email: 'contato@fornecedor.com',
phone: '11999999999',
active: true
})
};
fetch('https://api.example.com/suppliers', 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.example.com/suppliers",
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([
'name' => 'Fornecedor A',
'corporateName' => 'Fornecedor A LTDA',
'document' => '12345678000199',
'email' => 'contato@fornecedor.com',
'phone' => '11999999999',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/suppliers"
payload := strings.NewReader("{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/suppliers")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/suppliers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "e4b6d4e8-8e6d-41da-abdb-8fc358a9e7f1",
"name": "Distribuidora Tech",
"document": "12.345.678/0001-90",
"createdAt": "2024-02-15T10:00:00.000Z"
}
Suppliers
Criar Fornecedor
Insere um novo fornecedor (Supplier) no sistema para atrelamento com NFs ou produtos de catálogo.
POST
/
suppliers
Create a new supplier
curl --request POST \
--url https://api.example.com/suppliers \
--header 'Content-Type: application/json' \
--data '
{
"name": "Fornecedor A",
"corporateName": "Fornecedor A LTDA",
"document": "12345678000199",
"email": "contato@fornecedor.com",
"phone": "11999999999",
"active": true
}
'import requests
url = "https://api.example.com/suppliers"
payload = {
"name": "Fornecedor A",
"corporateName": "Fornecedor A LTDA",
"document": "12345678000199",
"email": "contato@fornecedor.com",
"phone": "11999999999",
"active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Fornecedor A',
corporateName: 'Fornecedor A LTDA',
document: '12345678000199',
email: 'contato@fornecedor.com',
phone: '11999999999',
active: true
})
};
fetch('https://api.example.com/suppliers', 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.example.com/suppliers",
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([
'name' => 'Fornecedor A',
'corporateName' => 'Fornecedor A LTDA',
'document' => '12345678000199',
'email' => 'contato@fornecedor.com',
'phone' => '11999999999',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/suppliers"
payload := strings.NewReader("{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/suppliers")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/suppliers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Fornecedor A\",\n \"corporateName\": \"Fornecedor A LTDA\",\n \"document\": \"12345678000199\",\n \"email\": \"contato@fornecedor.com\",\n \"phone\": \"11999999999\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "e4b6d4e8-8e6d-41da-abdb-8fc358a9e7f1",
"name": "Distribuidora Tech",
"document": "12.345.678/0001-90",
"createdAt": "2024-02-15T10:00:00.000Z"
}
Body
Nome Fantasia do fornecedor.
Opcional. Razão Social (se PJ).
Opcional. CNPJ ou CPF (aceita com ou sem formatação).
Endereço de e-mail p/ contato ou faturamento.
Telefone de contato.
Habilita ou desabilita o vendor.
Response
{
"id": "e4b6d4e8-8e6d-41da-abdb-8fc358a9e7f1",
"name": "Distribuidora Tech",
"document": "12.345.678/0001-90",
"createdAt": "2024-02-15T10:00:00.000Z"
}
Body
application/json
Commercial Name
Example:
"Fornecedor A"
Corporate Name (Razão Social)
Example:
"Fornecedor A LTDA"
Document (CNPJ/CPF)
Example:
"12345678000199"
Example:
"contato@fornecedor.com"
Phone
Example:
"11999999999"
Active Status
Response
201 - undefined
⌘I