Print orders
Submit a paid API print order
Requires a scoped API key and Idempotency-Key. The quote is account/environment scoped and freezes exactly one resolved provider; submission cannot alter it or split a mixed-provider order.
POST
/
v1
/
print-orders
Submit a paid API print order
curl --request POST \
--url https://api.batchrelay.com/v1/print-orders \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"quote_id": "<string>",
"order": {
"schema_version": 1,
"external_order_id": "<string>",
"ship_to": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"ship_from": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"items": [
{
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"template_render_id": "<string>",
"pixel_width": 2,
"pixel_height": 2,
"file_size_bytes": 2,
"hash": "<string>",
"printed_file_name": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
}
}
],
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"value": "<string>"
}
]
}
],
"customer": {
"external_id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
},
"integration_source": "direct_api"
}
'import requests
url = "https://api.batchrelay.com/v1/print-orders"
payload = {
"quote_id": "<string>",
"order": {
"schema_version": 1,
"external_order_id": "<string>",
"ship_to": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"ship_from": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"items": [
{
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"template_render_id": "<string>",
"pixel_width": 2,
"pixel_height": 2,
"file_size_bytes": 2,
"hash": "<string>",
"printed_file_name": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
}
}
],
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [{ "value": "<string>" }]
}
],
"customer": {
"external_id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
},
"integration_source": "direct_api"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quote_id: '<string>',
order: {
schema_version: 1,
external_order_id: '<string>',
ship_to: {
name: '<string>',
address_1: '<string>',
city: '<string>',
state: '<string>',
postal_code: '<string>',
country: '<string>',
phone: '<string>',
address_2: '<string>'
},
ship_from: {
name: '<string>',
address_1: '<string>',
city: '<string>',
state: '<string>',
postal_code: '<string>',
country: '<string>',
phone: '<string>',
address_2: '<string>'
},
items: [
{
product: {id: '<string>', revision: 2},
quantity: 2,
assets: [
{
url: '<string>',
asset_id: '<string>',
template_render_id: '<string>',
pixel_width: 2,
pixel_height: 2,
file_size_bytes: 2,
hash: '<string>',
printed_file_name: '<string>',
origin: {design_id: '<string>', design_version: 2}
}
],
options: [{option_id: '<string>', value: '<string>'}],
texts: [{value: '<string>'}]
}
],
customer: {
external_id: '<string>',
name: '<string>',
email: 'jsmith@example.com',
phone: '<string>'
}
},
integration_source: 'direct_api'
})
};
fetch('https://api.batchrelay.com/v1/print-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.batchrelay.com/v1/print-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([
'quote_id' => '<string>',
'order' => [
'schema_version' => 1,
'external_order_id' => '<string>',
'ship_to' => [
'name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postal_code' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'address_2' => '<string>'
],
'ship_from' => [
'name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postal_code' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'address_2' => '<string>'
],
'items' => [
[
'product' => [
'id' => '<string>',
'revision' => 2
],
'quantity' => 2,
'assets' => [
[
'url' => '<string>',
'asset_id' => '<string>',
'template_render_id' => '<string>',
'pixel_width' => 2,
'pixel_height' => 2,
'file_size_bytes' => 2,
'hash' => '<string>',
'printed_file_name' => '<string>',
'origin' => [
'design_id' => '<string>',
'design_version' => 2
]
]
],
'options' => [
[
'option_id' => '<string>',
'value' => '<string>'
]
],
'texts' => [
[
'value' => '<string>'
]
]
]
],
'customer' => [
'external_id' => '<string>',
'name' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>'
]
],
'integration_source' => 'direct_api'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.batchrelay.com/v1/print-orders"
payload := strings.NewReader("{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-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.post("https://api.batchrelay.com/v1/print-orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/print-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"external_order_id": "<string>",
"api_account_id": "<string>",
"quote_id": "<string>",
"status": "<string>",
"channel": "api",
"merchant_of_record": "batch_relay",
"price": {
"policy_id": "api-v1",
"currency": "USD",
"merchandise_cents": 1,
"shipping_cents": 1,
"platform_fee_cents": 1,
"platform_fee_label": "Batch Relay API Access Fee",
"tax_cents": 1,
"total_cents": 2
},
"provider": {
"provider_id": "whcc",
"provider_selection_source": "explicit",
"provider_environment": "sandbox",
"provider_availability": "preview",
"provider_capability_revision": "<string>",
"provider_recipe_revision": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}Headers
Minimum string length:
1Body
application/json
Response
Order reserved for payment/fulfillment
Pattern:
^bro_Allowed value:
"api"Allowed value:
"batch_relay"Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
Submit a paid API print order
curl --request POST \
--url https://api.batchrelay.com/v1/print-orders \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"quote_id": "<string>",
"order": {
"schema_version": 1,
"external_order_id": "<string>",
"ship_to": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"ship_from": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"items": [
{
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"template_render_id": "<string>",
"pixel_width": 2,
"pixel_height": 2,
"file_size_bytes": 2,
"hash": "<string>",
"printed_file_name": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
}
}
],
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [
{
"value": "<string>"
}
]
}
],
"customer": {
"external_id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
},
"integration_source": "direct_api"
}
'import requests
url = "https://api.batchrelay.com/v1/print-orders"
payload = {
"quote_id": "<string>",
"order": {
"schema_version": 1,
"external_order_id": "<string>",
"ship_to": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"ship_from": {
"name": "<string>",
"address_1": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>",
"address_2": "<string>"
},
"items": [
{
"product": {
"id": "<string>",
"revision": 2
},
"quantity": 2,
"assets": [
{
"url": "<string>",
"asset_id": "<string>",
"template_render_id": "<string>",
"pixel_width": 2,
"pixel_height": 2,
"file_size_bytes": 2,
"hash": "<string>",
"printed_file_name": "<string>",
"origin": {
"design_id": "<string>",
"design_version": 2
}
}
],
"options": [
{
"option_id": "<string>",
"value": "<string>"
}
],
"texts": [{ "value": "<string>" }]
}
],
"customer": {
"external_id": "<string>",
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>"
}
},
"integration_source": "direct_api"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quote_id: '<string>',
order: {
schema_version: 1,
external_order_id: '<string>',
ship_to: {
name: '<string>',
address_1: '<string>',
city: '<string>',
state: '<string>',
postal_code: '<string>',
country: '<string>',
phone: '<string>',
address_2: '<string>'
},
ship_from: {
name: '<string>',
address_1: '<string>',
city: '<string>',
state: '<string>',
postal_code: '<string>',
country: '<string>',
phone: '<string>',
address_2: '<string>'
},
items: [
{
product: {id: '<string>', revision: 2},
quantity: 2,
assets: [
{
url: '<string>',
asset_id: '<string>',
template_render_id: '<string>',
pixel_width: 2,
pixel_height: 2,
file_size_bytes: 2,
hash: '<string>',
printed_file_name: '<string>',
origin: {design_id: '<string>', design_version: 2}
}
],
options: [{option_id: '<string>', value: '<string>'}],
texts: [{value: '<string>'}]
}
],
customer: {
external_id: '<string>',
name: '<string>',
email: 'jsmith@example.com',
phone: '<string>'
}
},
integration_source: 'direct_api'
})
};
fetch('https://api.batchrelay.com/v1/print-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.batchrelay.com/v1/print-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([
'quote_id' => '<string>',
'order' => [
'schema_version' => 1,
'external_order_id' => '<string>',
'ship_to' => [
'name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postal_code' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'address_2' => '<string>'
],
'ship_from' => [
'name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'state' => '<string>',
'postal_code' => '<string>',
'country' => '<string>',
'phone' => '<string>',
'address_2' => '<string>'
],
'items' => [
[
'product' => [
'id' => '<string>',
'revision' => 2
],
'quantity' => 2,
'assets' => [
[
'url' => '<string>',
'asset_id' => '<string>',
'template_render_id' => '<string>',
'pixel_width' => 2,
'pixel_height' => 2,
'file_size_bytes' => 2,
'hash' => '<string>',
'printed_file_name' => '<string>',
'origin' => [
'design_id' => '<string>',
'design_version' => 2
]
]
],
'options' => [
[
'option_id' => '<string>',
'value' => '<string>'
]
],
'texts' => [
[
'value' => '<string>'
]
]
]
],
'customer' => [
'external_id' => '<string>',
'name' => '<string>',
'email' => 'jsmith@example.com',
'phone' => '<string>'
]
],
'integration_source' => 'direct_api'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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.batchrelay.com/v1/print-orders"
payload := strings.NewReader("{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-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.post("https://api.batchrelay.com/v1/print-orders")
.header("Idempotency-Key", "<idempotency-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/print-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quote_id\": \"<string>\",\n \"order\": {\n \"schema_version\": 1,\n \"external_order_id\": \"<string>\",\n \"ship_to\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"ship_from\": {\n \"name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_2\": \"<string>\"\n },\n \"items\": [\n {\n \"product\": {\n \"id\": \"<string>\",\n \"revision\": 2\n },\n \"quantity\": 2,\n \"assets\": [\n {\n \"url\": \"<string>\",\n \"asset_id\": \"<string>\",\n \"template_render_id\": \"<string>\",\n \"pixel_width\": 2,\n \"pixel_height\": 2,\n \"file_size_bytes\": 2,\n \"hash\": \"<string>\",\n \"printed_file_name\": \"<string>\",\n \"origin\": {\n \"design_id\": \"<string>\",\n \"design_version\": 2\n }\n }\n ],\n \"options\": [\n {\n \"option_id\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"texts\": [\n {\n \"value\": \"<string>\"\n }\n ]\n }\n ],\n \"customer\": {\n \"external_id\": \"<string>\",\n \"name\": \"<string>\",\n \"email\": \"jsmith@example.com\",\n \"phone\": \"<string>\"\n }\n },\n \"integration_source\": \"direct_api\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"external_order_id": "<string>",
"api_account_id": "<string>",
"quote_id": "<string>",
"status": "<string>",
"channel": "api",
"merchant_of_record": "batch_relay",
"price": {
"policy_id": "api-v1",
"currency": "USD",
"merchandise_cents": 1,
"shipping_cents": 1,
"platform_fee_cents": 1,
"platform_fee_label": "Batch Relay API Access Fee",
"tax_cents": 1,
"total_cents": 2
},
"provider": {
"provider_id": "whcc",
"provider_selection_source": "explicit",
"provider_environment": "sandbox",
"provider_availability": "preview",
"provider_capability_revision": "<string>",
"provider_recipe_revision": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}{
"error": "<string>",
"code": "<string>",
"message": "<string>",
"docs_url": "<string>",
"request_id": "<string>"
}