Criar Pedido
curl --request POST \
--url https://api.example.com/orders \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Store-Id: <x-store-id>' \
--data '
{
"order_id": "<string>",
"order_date": "<string>",
"delivery_date": "<string>",
"request_review_at": "<string>",
"products": [
{
"products[].product_id": "<string>",
"products[].sku": "<string>",
"products[].name": "<string>",
"products[].price": 123,
"products[].url": "<string>",
"products[].pictures": [
{}
],
"products[].gtin": "<string>",
"products[].mpn": "<string>"
}
],
"customers": [
{
"customers[].name": "<string>",
"customers[].email": "<string>",
"customers[].phone": "<string>",
"customers[].origin": "<string>"
}
]
}
'import requests
url = "https://api.example.com/orders"
payload = {
"order_id": "<string>",
"order_date": "<string>",
"delivery_date": "<string>",
"request_review_at": "<string>",
"products": [
{
"products[].product_id": "<string>",
"products[].sku": "<string>",
"products[].name": "<string>",
"products[].price": 123,
"products[].url": "<string>",
"products[].pictures": [{}],
"products[].gtin": "<string>",
"products[].mpn": "<string>"
}
],
"customers": [
{
"customers[].name": "<string>",
"customers[].email": "<string>",
"customers[].phone": "<string>",
"customers[].origin": "<string>"
}
]
}
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({
order_id: '<string>',
order_date: '<string>',
delivery_date: '<string>',
request_review_at: '<string>',
products: [
{
'products[].product_id': '<string>',
'products[].sku': '<string>',
'products[].name': '<string>',
'products[].price': 123,
'products[].url': '<string>',
'products[].pictures': [{}],
'products[].gtin': '<string>',
'products[].mpn': '<string>'
}
],
customers: [
{
'customers[].name': '<string>',
'customers[].email': '<string>',
'customers[].phone': '<string>',
'customers[].origin': '<string>'
}
]
})
};
fetch('https://api.example.com/orders', 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/orders",
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([
'order_id' => '<string>',
'order_date' => '<string>',
'delivery_date' => '<string>',
'request_review_at' => '<string>',
'products' => [
[
'products[].product_id' => '<string>',
'products[].sku' => '<string>',
'products[].name' => '<string>',
'products[].price' => 123,
'products[].url' => '<string>',
'products[].pictures' => [
[
]
],
'products[].gtin' => '<string>',
'products[].mpn' => '<string>'
]
],
'customers' => [
[
'customers[].name' => '<string>',
'customers[].email' => '<string>',
'customers[].phone' => '<string>',
'customers[].origin' => '<string>'
]
]
]),
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/orders"
payload := strings.NewReader("{\n \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\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/orders")
.header("X-API-Key", "<x-api-key>")
.header("X-Store-Id", "<x-store-id>")
.header("Content-Type", "<content-type>")
.body("{\n \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/orders")
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 \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>"
}API
Criar Pedido
Cria um novo pedido no Martan
POST
/
orders
Criar Pedido
curl --request POST \
--url https://api.example.com/orders \
--header 'Content-Type: <content-type>' \
--header 'X-API-Key: <x-api-key>' \
--header 'X-Store-Id: <x-store-id>' \
--data '
{
"order_id": "<string>",
"order_date": "<string>",
"delivery_date": "<string>",
"request_review_at": "<string>",
"products": [
{
"products[].product_id": "<string>",
"products[].sku": "<string>",
"products[].name": "<string>",
"products[].price": 123,
"products[].url": "<string>",
"products[].pictures": [
{}
],
"products[].gtin": "<string>",
"products[].mpn": "<string>"
}
],
"customers": [
{
"customers[].name": "<string>",
"customers[].email": "<string>",
"customers[].phone": "<string>",
"customers[].origin": "<string>"
}
]
}
'import requests
url = "https://api.example.com/orders"
payload = {
"order_id": "<string>",
"order_date": "<string>",
"delivery_date": "<string>",
"request_review_at": "<string>",
"products": [
{
"products[].product_id": "<string>",
"products[].sku": "<string>",
"products[].name": "<string>",
"products[].price": 123,
"products[].url": "<string>",
"products[].pictures": [{}],
"products[].gtin": "<string>",
"products[].mpn": "<string>"
}
],
"customers": [
{
"customers[].name": "<string>",
"customers[].email": "<string>",
"customers[].phone": "<string>",
"customers[].origin": "<string>"
}
]
}
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({
order_id: '<string>',
order_date: '<string>',
delivery_date: '<string>',
request_review_at: '<string>',
products: [
{
'products[].product_id': '<string>',
'products[].sku': '<string>',
'products[].name': '<string>',
'products[].price': 123,
'products[].url': '<string>',
'products[].pictures': [{}],
'products[].gtin': '<string>',
'products[].mpn': '<string>'
}
],
customers: [
{
'customers[].name': '<string>',
'customers[].email': '<string>',
'customers[].phone': '<string>',
'customers[].origin': '<string>'
}
]
})
};
fetch('https://api.example.com/orders', 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/orders",
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([
'order_id' => '<string>',
'order_date' => '<string>',
'delivery_date' => '<string>',
'request_review_at' => '<string>',
'products' => [
[
'products[].product_id' => '<string>',
'products[].sku' => '<string>',
'products[].name' => '<string>',
'products[].price' => 123,
'products[].url' => '<string>',
'products[].pictures' => [
[
]
],
'products[].gtin' => '<string>',
'products[].mpn' => '<string>'
]
],
'customers' => [
[
'customers[].name' => '<string>',
'customers[].email' => '<string>',
'customers[].phone' => '<string>',
'customers[].origin' => '<string>'
]
]
]),
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/orders"
payload := strings.NewReader("{\n \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\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/orders")
.header("X-API-Key", "<x-api-key>")
.header("X-Store-Id", "<x-store-id>")
.header("Content-Type", "<content-type>")
.body("{\n \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/orders")
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 \"order_id\": \"<string>\",\n \"order_date\": \"<string>\",\n \"delivery_date\": \"<string>\",\n \"request_review_at\": \"<string>\",\n \"products\": [\n {\n \"products[].product_id\": \"<string>\",\n \"products[].sku\": \"<string>\",\n \"products[].name\": \"<string>\",\n \"products[].price\": 123,\n \"products[].url\": \"<string>\",\n \"products[].pictures\": [\n {}\n ],\n \"products[].gtin\": \"<string>\",\n \"products[].mpn\": \"<string>\"\n }\n ],\n \"customers\": [\n {\n \"customers[].name\": \"<string>\",\n \"customers[].email\": \"<string>\",\n \"customers[].phone\": \"<string>\",\n \"customers[].origin\": \"<string>\"\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 pedido no seu sistema
string
required
Data do pedido no formato ISO 8601 (ex:
2024-01-01T00:00:00.000Z)string
required
Data de entrega do pedido no formato ISO 8601
string
Data para solicitar review (opcional). Se não fornecido, será calculado automaticamente baseado nas configurações da store, evitando fins de semana.
array
required
Array de produtos do pedido (mínimo 1 produto)
Show Estrutura do produto
Show Estrutura do produto
array
required
Response
string
ID único do pedido criado no sistema Martan
Erros Possíveis
| Status | Código | Descrição |
|---|---|---|
| 400 | 802030 | Body JSON mal formatado ou validação falhou |
| 422 | 103 | Pedido já existe (duplicado) |
| 403 | 8121206 | Limite de uso de pedidos excedido para o plano |
request_review_at não foi fornecido, então será calculado automaticamente baseado nas configurações da Loja.⌘I
