Update a supplier
curl --request PATCH \
--url https://api.example.com/suppliers/{id} \
--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/{id}"
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.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/{id}"
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("PATCH", 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.patch("https://api.example.com/suppliers/{id}")
.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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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": "Tech Update Corp",
"active": false,
"updatedAt": "2024-02-15T15:00:00.000Z"
}
Suppliers
Atualizar Fornecedor
Atualiza de modo parcial os dados do cadastro de um fornecedor (ex: se ele mudou o e-mail, telefone, ou para inativá-lo).
PATCH
/
suppliers
/
{id}
Update a supplier
curl --request PATCH \
--url https://api.example.com/suppliers/{id} \
--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/{id}"
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.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
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/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
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/{id}"
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("PATCH", 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.patch("https://api.example.com/suppliers/{id}")
.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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.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": "Tech Update Corp",
"active": false,
"updatedAt": "2024-02-15T15:00:00.000Z"
}
Path
UUID do Fornecedor
Body
(Qualquer campo opcional)Novo nome fantasia
Mudar o status habilitado p/ listas
Novo e-mail
Response
{
"id": "e4b6d4e8-8e6d-41da-abdb-8fc358a9e7f1",
"name": "Tech Update Corp",
"active": false,
"updatedAt": "2024-02-15T15:00:00.000Z"
}
Path Parameters
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
200 - undefined
⌘I