Criar Produto
curl --request POST \
--url https://api.example.com/products \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Store-Id: <x-store-id>' \
--data '
{
"product_id": "<string>",
"name": "<string>",
"price": 123,
"sku": "<string>",
"gtin": "<string>",
"mpn": "<string>",
"url": "<string>",
"pictures": [
{}
]
}
'import requests
url = "https://api.example.com/products"
payload = {
"product_id": "<string>",
"name": "<string>",
"price": 123,
"sku": "<string>",
"gtin": "<string>",
"mpn": "<string>",
"url": "<string>",
"pictures": [{}]
}
headers = {
"X-API-Key": "<x-api-key>",
"X-Store-Id": "<x-store-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<x-api-key>',
'X-Store-Id': '<x-store-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
product_id: '<string>',
name: '<string>',
price: 123,
sku: '<string>',
gtin: '<string>',
mpn: '<string>',
url: '<string>',
pictures: [{}]
})
};
fetch('https://api.example.com/products', 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/products",
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([
'product_id' => '<string>',
'name' => '<string>',
'price' => 123,
'sku' => '<string>',
'gtin' => '<string>',
'mpn' => '<string>',
'url' => '<string>',
'pictures' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"X-API-Key: <x-api-key>",
"X-Store-Id: <x-store-id>"
],
]);
$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/products"
payload := strings.NewReader("{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Store-Id", "<x-store-id>")
req.Header.Add("Content-Type", "<content-type>")
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/products")
.header("X-API-Key", "<x-api-key>")
.header("X-Store-Id", "<x-store-id>")
.header("Content-Type", "<content-type>")
.body("{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Store-Id"] = '<x-store-id>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}API
Criar Produto
Cria um novo produto no Martan.
POST
/
products
Criar Produto
curl --request POST \
--url https://api.example.com/products \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Store-Id: <x-store-id>' \
--data '
{
"product_id": "<string>",
"name": "<string>",
"price": 123,
"sku": "<string>",
"gtin": "<string>",
"mpn": "<string>",
"url": "<string>",
"pictures": [
{}
]
}
'import requests
url = "https://api.example.com/products"
payload = {
"product_id": "<string>",
"name": "<string>",
"price": 123,
"sku": "<string>",
"gtin": "<string>",
"mpn": "<string>",
"url": "<string>",
"pictures": [{}]
}
headers = {
"X-API-Key": "<x-api-key>",
"X-Store-Id": "<x-store-id>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-Key': '<x-api-key>',
'X-Store-Id': '<x-store-id>',
'Content-Type': '<content-type>'
},
body: JSON.stringify({
product_id: '<string>',
name: '<string>',
price: 123,
sku: '<string>',
gtin: '<string>',
mpn: '<string>',
url: '<string>',
pictures: [{}]
})
};
fetch('https://api.example.com/products', 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/products",
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([
'product_id' => '<string>',
'name' => '<string>',
'price' => 123,
'sku' => '<string>',
'gtin' => '<string>',
'mpn' => '<string>',
'url' => '<string>',
'pictures' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: <content-type>",
"X-API-Key: <x-api-key>",
"X-Store-Id: <x-store-id>"
],
]);
$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/products"
payload := strings.NewReader("{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("X-Store-Id", "<x-store-id>")
req.Header.Add("Content-Type", "<content-type>")
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/products")
.header("X-API-Key", "<x-api-key>")
.header("X-Store-Id", "<x-store-id>")
.header("Content-Type", "<content-type>")
.body("{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/products")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["X-Store-Id"] = '<x-store-id>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"product_id\": \"<string>\",\n \"name\": \"<string>\",\n \"price\": 123,\n \"sku\": \"<string>\",\n \"gtin\": \"<string>\",\n \"mpn\": \"<string>\",\n \"url\": \"<string>\",\n \"pictures\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}Headers
string
required
Sua API key do tipo
ordersstring
required
ID da sua loja
string
required
Deve ser
application/jsonBody
string
required
ID único do produto no seu sistema
string
required
Nome do produto
number
required
Preço do produto (0 a 9999999999). Se não fornecido, será 0 por padrão.
string
required
SKU do produto
string
required
Código GTIN do produto
string
required
Código MPN do produto
string
required
URL do produto
array
Array de URLs de imagens do produto
Response
string
ID único do produto criado no sistema Martan
Erros Possíveis
| Status | Código | Descrição |
|---|---|---|
| 400 | 802030 | Body JSON mal formatado ou validação falhou |
| 422 | 103 | Produto já existe (mesmo product_id e store_id) |
| 500 | 520 | Erro inesperado ao buscar ou criar produto |
