Skip to main content
PATCH
/
v1
/
vendors
/
{id}
Atualizar um vendedor
curl --request PATCH \
  --url https://api.malga.io/v1/vendors/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --header 'X-Client-Id: <api-key>' \
  --data '
{
  "referenceId": "12345",
  "name": "Empresa Exemplo Ltda"
}
'
import requests

url = "https://api.malga.io/v1/vendors/{id}"

payload = {
    "referenceId": "12345",
    "name": "Empresa Exemplo Ltda"
}
headers = {
    "X-Client-Id": "<api-key>",
    "X-Api-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PATCH',
  headers: {
    'X-Client-Id': '<api-key>',
    'X-Api-Key': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({referenceId: '12345', name: 'Empresa Exemplo Ltda'})
};

fetch('https://api.malga.io/v1/vendors/{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.malga.io/v1/vendors/{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([
    'referenceId' => '12345',
    'name' => 'Empresa Exemplo Ltda'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "X-Api-Key: <api-key>",
    "X-Client-Id: <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://api.malga.io/v1/vendors/{id}"

	payload := strings.NewReader("{\n  \"referenceId\": \"12345\",\n  \"name\": \"Empresa Exemplo Ltda\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("X-Client-Id", "<api-key>")
	req.Header.Add("X-Api-Key", "<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.patch("https://api.malga.io/v1/vendors/{id}")
  .header("X-Client-Id", "<api-key>")
  .header("X-Api-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"referenceId\": \"12345\",\n  \"name\": \"Empresa Exemplo Ltda\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.malga.io/v1/vendors/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-Client-Id"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"referenceId\": \"12345\",\n  \"name\": \"Empresa Exemplo Ltda\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "db56bd6a-10d7-4039-9c68-fc4405a1a3e1",
  "referenceId": "12345",
  "identityType": "CNPJ",
  "identity": "12.345.678/0001-99",
  "mcc": "1234",
  "name": "Empresa Exemplo Ltda",
  "email": "contato@empresaexemplo.com",
  "phoneNumber": "5511999999999",
  "website": "https://www.empresaexemplo.com",
  "address": {
    "country": "BR",
    "state": "SP",
    "city": "São Paulo",
    "district": "Centro",
    "zipCode": "01001-000",
    "street": "Avenida Paulista",
    "streetNumber": "1000",
    "complement": "Apto 101"
  },
  "updatedAt": "2024-06-26T12:34:56Z",
  "createdAt": "2024-06-01T08:00:00Z"
}
{
  "error": {
    "code": 123,
    "declinedCode": "<string>",
    "key": "<string>",
    "businessCode": "<string>",
    "message": "<string>",
    "details": "<array>"
  }
}
{
  "error": {
    "code": 123,
    "declinedCode": "<string>",
    "key": "<string>",
    "businessCode": "<string>",
    "message": "<string>",
    "details": "<array>"
  }
}
{
  "error": {
    "code": 123,
    "declinedCode": "<string>",
    "key": "<string>",
    "businessCode": "<string>",
    "message": "<string>",
    "details": "<array>"
  }
}

Authorizations

X-Client-Id
string
header
required
X-Api-Key
string
header
required

Path Parameters

id
string<uuid>
required

id do vendedor que deseja alterar

Body

application/json
referenceId
string

Identificador do vendedor no seu sistema

identityType
enum<string>

Tipo de documento

Available options:
CPF,
CNPJ
identity
string

Número do documento formato conforme tipo selecionado

mcc
string

Código de segmento do lojista no adquirente, solicite ao seu provedor caso não saiba qual o seu Merchant Category Code.

name
string

Nome Completo / Razão Social

email
string

Email do vendedor

phoneNumber
string

Telefone de contato do vendedor

website
string

identificação do merchant id a ser utilizado

address
object

Response

Success

id
string

Identificador do vendedor na malga

referenceId
string

Identificador do vendedor no seu sistema

identityType
enum<string>

Tipo de documento

Available options:
CPF,
CNPJ
identity
string

Número do documento formato conforme tipo selecionado

mcc
string

Código de segmento do lojista no adquirente, solicite ao seu provedor caso não saiba qual o seu Merchant Category Code.

name
string

Nome Completo / Razão Social

email
string

Email do vendedor

phoneNumber
string

Telefone de contato do vendedor

website
string

identificação do merchant id a ser utilizado

address
object
updatedAt
string

Data de alteração do vendedor

createdAt
string

Data de criação do vendedor