Create a label
Name | Type | Description |
---|---|---|
service_type * | string | Service Types Accepts: newgistics_bound_printed_matter ,newgistics_first_class_mail ,newgistics_parcel_select ,newgistics_parcel_select_lightweight ,newgistics_priority_mail . |
shipper_account * | reference | Object reference |
shipment * | shipment | An instance of shipping freight or cargo |
async | boolean | enable async mode or not (set to false if not provided) |
return_shipment | boolean | (set to false if not provided) |
paper_size | string | Label Paper Size Accepts: a4 ,4x6 ,4x8 ,default . (set to "default" if not provided) |
file_type | string | Label file type Accepts: pdf . (set to "pdf" if not provided) |
ship_date | string | Ship Date in YYYY-MM-DD, if not provided, will be today of the shipper account timezone |
service_options | array of service option - general | Service options |
is_document | boolean | If the shipment is document type. (set to false if not provided) |
invoice | invoice | Invoice object, used to describe invoice type. Optional. Commercial invoice will be generated if field is present in the request body, else not. |
references | array of strings | Reference numbers for a label. Maximum 3 elements are acceptable |
billing | billing | Billing Object |
customs | customs | Customs Object |
order_number | string | A user-defined order number used to identify an order. |
{
"shipper_account": {
"id": "your-shipper-account-id"
},
"service_options": [
{
"type": "signature",
"enabled": true
}
],
"async": false,
"return_shipment": false,
"paper_size": "4x6",
"service_type": "newgistics_parcel_select",
"is_document": false,
"invoice": {
"number": "just-for-the-test-invoice-number",
"date": "2019-05-12"
},
"references": [
"reference1",
"reference2"
],
"shipment": {
"ship_from": {
"contact_name": "Panda1",
"phone": "302-0123-1234",
"fax": "302-0123-1234",
"email": "support@Panda1.com",
"company_name": "The Shipping Company",
"street1": "27 Waterview Drive",
"city": "Shelton",
"state": "CT",
"postal_code": "06484",
"country": "USA",
"type": "residential",
"tax_id": "TIN728992"
},
"ship_to": {
"contact_name": "Panda2",
"phone": "302-0123-1234",
"fax": "302-0123-1234",
"email": "support@PandaMan.com",
"company_name": "The Shipping Company",
"street1": "1 Sullivan St",
"city": "Berwick",
"postal_code": "03901-2926",
"state": "WA",
"country": "USA",
"type": "residential",
"tax_id": "TIN728992"
},
"parcels": [
{
"description": "Food XS",
"box_type": "custom",
"weight": {
"value": 2,
"unit": "oz"
},
"dimension": {
"width": 6,
"height": 6,
"depth": 12,
"unit": "cm"
},
"items": [
{
"description": "Food Bar",
"origin_country": "USA",
"quantity": 2,
"price": {
"amount": 3,
"currency": "USD"
},
"weight": {
"value": 1,
"unit": "oz"
},
"sku": "Epic_Food_Bar",
"hs_code": "23528222"
}
]
}
]
},
"customs": {
"purpose": "sample",
"terms_of_trade": "ddu"
}
}
curl --request POST \
--url https://sandbox-api.postmen.com/v3/labels \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
--data '{"shipper_account":{"id":"your-shipper-account-id"},"service_options":[{"type":"signature","enabled":true}],"async":false,"return_shipment":false,"paper_size":"4x6","service_type":"newgistics_parcel_select","is_document":false,"invoice":{"number":"just-for-the-test-invoice-number","date":"2019-05-12"},"references":["reference1","reference2"],"shipment":{"ship_from":{"contact_name":"Panda1","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@Panda1.com","company_name":"The Shipping Company","street1":"27 Waterview Drive","city":"Shelton","state":"CT","postal_code":"06484","country":"USA","type":"residential","tax_id":"TIN728992"},"ship_to":{"contact_name":"Panda2","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@PandaMan.com","company_name":"The Shipping Company","street1":"1 Sullivan St","city":"Berwick","postal_code":"03901-2926","state":"WA","country":"USA","type":"residential","tax_id":"TIN728992"},"parcels":[{"description":"Food XS","box_type":"custom","weight":{"value":2,"unit":"oz"},"dimension":{"width":6,"height":6,"depth":12,"unit":"cm"},"items":[{"description":"Food Bar","origin_country":"USA","quantity":2,"price":{"amount":3,"currency":"USD"},"weight":{"value":1,"unit":"oz"},"sku":"Epic_Food_Bar","hs_code":"23528222"}]}]},"customs":{"purpose":"sample","terms_of_trade":"ddu"}}'
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels");
string json = "{\"shipper_account\":{\"id\":\"your-shipper-account-id\"},\"service_options\":[{\"type\":\"signature\",\"enabled\":true}],\"async\":false,\"return_shipment\":false,\"paper_size\":\"4x6\",\"service_type\":\"newgistics_parcel_select\",\"is_document\":false,\"invoice\":{\"number\":\"just-for-the-test-invoice-number\",\"date\":\"2019-05-12\"},\"references\":[\"reference1\",\"reference2\"],\"shipment\":{\"ship_from\":{\"contact_name\":\"Panda1\",\"phone\":\"302-0123-1234\",\"fax\":\"302-0123-1234\",\"email\":\"support@Panda1.com\",\"company_name\":\"The Shipping Company\",\"street1\":\"27 Waterview Drive\",\"city\":\"Shelton\",\"state\":\"CT\",\"postal_code\":\"06484\",\"country\":\"USA\",\"type\":\"residential\",\"tax_id\":\"TIN728992\"},\"ship_to\":{\"contact_name\":\"Panda2\",\"phone\":\"302-0123-1234\",\"fax\":\"302-0123-1234\",\"email\":\"support@PandaMan.com\",\"company_name\":\"The Shipping Company\",\"street1\":\"1 Sullivan St\",\"city\":\"Berwick\",\"postal_code\":\"03901-2926\",\"state\":\"WA\",\"country\":\"USA\",\"type\":\"residential\",\"tax_id\":\"TIN728992\"},\"parcels\":[{\"description\":\"Food XS\",\"box_type\":\"custom\",\"weight\":{\"value\":2,\"unit\":\"oz\"},\"dimension\":{\"width\":6,\"height\":6,\"depth\":12,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"origin_country\":\"USA\",\"quantity\":2,\"price\":{\"amount\":3,\"currency\":\"USD\"},\"weight\":{\"value\":1,\"unit\":\"oz\"},\"sku\":\"Epic_Food_Bar\",\"hs_code\":\"23528222\"}]}]},\"customs\":{\"purpose\":\"sample\",\"terms_of_trade\":\"ddu\"}}";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"shipper_account\":{\"id\":\"your-shipper-account-id\"},\"service_options\":[{\"type\":\"signature\",\"enabled\":true}],\"async\":false,\"return_shipment\":false,\"paper_size\":\"4x6\",\"service_type\":\"newgistics_parcel_select\",\"is_document\":false,\"invoice\":{\"number\":\"just-for-the-test-invoice-number\",\"date\":\"2019-05-12\"},\"references\":[\"reference1\",\"reference2\"],\"shipment\":{\"ship_from\":{\"contact_name\":\"Panda1\",\"phone\":\"302-0123-1234\",\"fax\":\"302-0123-1234\",\"email\":\"support@Panda1.com\",\"company_name\":\"The Shipping Company\",\"street1\":\"27 Waterview Drive\",\"city\":\"Shelton\",\"state\":\"CT\",\"postal_code\":\"06484\",\"country\":\"USA\",\"type\":\"residential\",\"tax_id\":\"TIN728992\"},\"ship_to\":{\"contact_name\":\"Panda2\",\"phone\":\"302-0123-1234\",\"fax\":\"302-0123-1234\",\"email\":\"support@PandaMan.com\",\"company_name\":\"The Shipping Company\",\"street1\":\"1 Sullivan St\",\"city\":\"Berwick\",\"postal_code\":\"03901-2926\",\"state\":\"WA\",\"country\":\"USA\",\"type\":\"residential\",\"tax_id\":\"TIN728992\"},\"parcels\":[{\"description\":\"Food XS\",\"box_type\":\"custom\",\"weight\":{\"value\":2,\"unit\":\"oz\"},\"dimension\":{\"width\":6,\"height\":6,\"depth\":12,\"unit\":\"cm\"},\"items\":[{\"description\":\"Food Bar\",\"origin_country\":\"USA\",\"quantity\":2,\"price\":{\"amount\":3,\"currency\":\"USD\"},\"weight\":{\"value\":1,\"unit\":\"oz\"},\"sku\":\"Epic_Food_Bar\",\"hs_code\":\"23528222\"}]}]},\"customs\":{\"purpose\":\"sample\",\"terms_of_trade\":\"ddu\"}}");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels")
.post(body)
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'POST',
url: 'https://sandbox-api.postmen.com/v3/labels',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
},
body: '{"shipper_account":{"id":"your-shipper-account-id"},"service_options":[{"type":"signature","enabled":true}],"async":false,"return_shipment":false,"paper_size":"4x6","service_type":"newgistics_parcel_select","is_document":false,"invoice":{"number":"just-for-the-test-invoice-number","date":"2019-05-12"},"references":["reference1","reference2"],"shipment":{"ship_from":{"contact_name":"Panda1","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@Panda1.com","company_name":"The Shipping Company","street1":"27 Waterview Drive","city":"Shelton","state":"CT","postal_code":"06484","country":"USA","type":"residential","tax_id":"TIN728992"},"ship_to":{"contact_name":"Panda2","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@PandaMan.com","company_name":"The Shipping Company","street1":"1 Sullivan St","city":"Berwick","postal_code":"03901-2926","state":"WA","country":"USA","type":"residential","tax_id":"TIN728992"},"parcels":[{"description":"Food XS","box_type":"custom","weight":{"value":2,"unit":"oz"},"dimension":{"width":6,"height":6,"depth":12,"unit":"cm"},"items":[{"description":"Food Bar","origin_country":"USA","quantity":2,"price":{"amount":3,"currency":"USD"},"weight":{"value":1,"unit":"oz"},"sku":"Epic_Food_Bar","hs_code":"23528222"}]}]},"customs":{"purpose":"sample","terms_of_trade":"ddu"}}'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels';
$method = 'POST';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$body = '{"shipper_account":{"id":"your-shipper-account-id"},"service_options":[{"type":"signature","enabled":true}],"async":false,"return_shipment":false,"paper_size":"4x6","service_type":"newgistics_parcel_select","is_document":false,"invoice":{"number":"just-for-the-test-invoice-number","date":"2019-05-12"},"references":["reference1","reference2"],"shipment":{"ship_from":{"contact_name":"Panda1","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@Panda1.com","company_name":"The Shipping Company","street1":"27 Waterview Drive","city":"Shelton","state":"CT","postal_code":"06484","country":"USA","type":"residential","tax_id":"TIN728992"},"ship_to":{"contact_name":"Panda2","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@PandaMan.com","company_name":"The Shipping Company","street1":"1 Sullivan St","city":"Berwick","postal_code":"03901-2926","state":"WA","country":"USA","type":"residential","tax_id":"TIN728992"},"parcels":[{"description":"Food XS","box_type":"custom","weight":{"value":2,"unit":"oz"},"dimension":{"width":6,"height":6,"depth":12,"unit":"cm"},"items":[{"description":"Food Bar","origin_country":"USA","quantity":2,"price":{"amount":3,"currency":"USD"},"weight":{"value":1,"unit":"oz"},"sku":"Epic_Food_Bar","hs_code":"23528222"}]}]},"customs":{"purpose":"sample","terms_of_trade":"ddu"}}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $body
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels'
payload = '''
{
"shipper_account": {
"id": "your-shipper-account-id"
},
"service_options": [
{
"type": "signature",
"enabled": true
}
],
"async": false,
"return_shipment": false,
"paper_size": "4x6",
"service_type": "newgistics_parcel_select",
"is_document": false,
"invoice": {
"number": "just-for-the-test-invoice-number",
"date": "2019-05-12"
},
"references": [
"reference1",
"reference2"
],
"shipment": {
"ship_from": {
"contact_name": "Panda1",
"phone": "302-0123-1234",
"fax": "302-0123-1234",
"email": "support@Panda1.com",
"company_name": "The Shipping Company",
"street1": "27 Waterview Drive",
"city": "Shelton",
"state": "CT",
"postal_code": "06484",
"country": "USA",
"type": "residential",
"tax_id": "TIN728992"
},
"ship_to": {
"contact_name": "Panda2",
"phone": "302-0123-1234",
"fax": "302-0123-1234",
"email": "support@PandaMan.com",
"company_name": "The Shipping Company",
"street1": "1 Sullivan St",
"city": "Berwick",
"postal_code": "03901-2926",
"state": "WA",
"country": "USA",
"type": "residential",
"tax_id": "TIN728992"
},
"parcels": [
{
"description": "Food XS",
"box_type": "custom",
"weight": {
"value": 2,
"unit": "oz"
},
"dimension": {
"width": 6,
"height": 6,
"depth": 12,
"unit": "cm"
},
"items": [
{
"description": "Food Bar",
"origin_country": "USA",
"quantity": 2,
"price": {
"amount": 3,
"currency": "USD"
},
"weight": {
"value": 1,
"unit": "oz"
},
"sku": "Epic_Food_Bar",
"hs_code": "23528222"
}
]
}
]
},
"customs": {
"purpose": "sample",
"terms_of_trade": "ddu"
}
}
'''
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('POST', url, data=payload, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
request.body = '{"shipper_account":{"id":"your-shipper-account-id"},"service_options":[{"type":"signature","enabled":true}],"async":false,"return_shipment":false,"paper_size":"4x6","service_type":"newgistics_parcel_select","is_document":false,"invoice":{"number":"just-for-the-test-invoice-number","date":"2019-05-12"},"references":["reference1","reference2"],"shipment":{"ship_from":{"contact_name":"Panda1","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@Panda1.com","company_name":"The Shipping Company","street1":"27 Waterview Drive","city":"Shelton","state":"CT","postal_code":"06484","country":"USA","type":"residential","tax_id":"TIN728992"},"ship_to":{"contact_name":"Panda2","phone":"302-0123-1234","fax":"302-0123-1234","email":"support@PandaMan.com","company_name":"The Shipping Company","street1":"1 Sullivan St","city":"Berwick","postal_code":"03901-2926","state":"WA","country":"USA","type":"residential","tax_id":"TIN728992"},"parcels":[{"description":"Food XS","box_type":"custom","weight":{"value":2,"unit":"oz"},"dimension":{"width":6,"height":6,"depth":12,"unit":"cm"},"items":[{"description":"Food Bar","origin_country":"USA","quantity":2,"price":{"amount":3,"currency":"USD"},"weight":{"value":1,"unit":"oz"},"sku":"Epic_Food_Bar","hs_code":"23528222"}]}]},"customs":{"purpose":"sample","terms_of_trade":"ddu"}}'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
id | string | Label ID |
status | string | Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
ship_date | string | Ship Date in YYYY-MM-DD |
tracking_numbers | array of strings | |
files | a files object | A files object |
rate | rate type | The amount of a charge or payment with reference to some basis of calculation. |
created_at | string | A formatted date. |
updated_at | string | A formatted date. |
references | array of strings | Reference numbers for a label. Maximum 3 elements are acceptable |
shipper_account | object | account of shipper |
service_type | string | Service Types Accepts: newgistics_bound_printed_matter ,newgistics_first_class_mail ,newgistics_parcel_select ,newgistics_parcel_select_lightweight ,newgistics_priority_mail . |
Response example
{
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"tracking_numbers": [
"xxxxxx-TEST"
],
"files": {
"label": {
"paper_size": "default",
"url": "https://sandbox-download.postmen.com/label/2019-05-27/00000000-0000-0000-0000-0000000083300-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-05-29/23afa3-13d8-43d3-b4fd-5a1e6b2eee2b-1559582624611413855.pdf",
"file_type": "pdf"
}
},
"rate": {
"service_type": "newgistics_parcel_select",
"service_name": "Parcel Select",
"shipper_account": {
"id": "newgistics",
"slug": "newgistics",
"description": "newgistics"
},
"info_message": "No rate quotes returned from carrier."
},
"created_at": "2019-05-28T09:14:51+00:00",
"updated_at": "2019-05-28T09:14:56+00:00",
"ship_date": "2019-05-28",
"status": "created",
"id": "e2595db2-f338-4c17-89d4-0484a75e71ed"
}
}
Retrieve a label
{}
curl --request GET \
--url https://sandbox-api.postmen.com/v3/labels/ \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels/");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels/")
.get()
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'GET',
url: 'https://sandbox-api.postmen.com/v3/labels/',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels/';
$method = 'GET';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels/'
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('GET', url, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels/')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
id | string | Label ID |
status | string | Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
ship_date | string | Ship Date in YYYY-MM-DD |
tracking_numbers | array of strings | |
files | a files object | A files object |
rate | rate type | The amount of a charge or payment with reference to some basis of calculation. |
created_at | string | A formatted date. |
updated_at | string | A formatted date. |
Response example
No example available
List all labels
Optional parameters
Name | Type | Description |
---|---|---|
shipper_account_id | string | Shipper account ID |
status | string | Label status Accepts: creating ,created ,cancelling ,cancelled ,manifesting ,manifested ,failed . |
limit | string | Number of records per page |
created_at_min | string | Start date and time of the record created (format YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+00:00, default: 24hrs ago) |
created_at_max | string | End date and time of the record created (format YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+00:00, default: NOW()) |
tracking_numbers | string | Tracking numbers (separated by comma) |
s | string | Partial search of tracking_number or reference |
next_token | string | Next token |
{}
curl --request GET \
--url https://sandbox-api.postmen.com/v3/labels \
--header 'content-type: application/json' \
--header 'postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e' \
using System;
using System.Net;
using System.IO;
class ExamplePostmen
{
static void Main(string[] args)
{
WebRequest httpWebRequest = WebRequest.Create("https://sandbox-api.postmen.com/v3/labels");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "GET";
httpWebRequest.Headers["postmen-api-key"] = "8fc7966b-679b-4a57-911d-c5a663229c9e";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
string result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
import com.squareup.okhttp.*;
public class test {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
Request request = new Request.Builder()
.url("https://sandbox-api.postmen.com/v3/labels")
.get()
.addHeader("postmen-api-key", "8fc7966b-679b-4a57-911d-c5a663229c9e")
.addHeader("content-type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (Exception e) {
System.err.println("Caught IOException: " + e.getMessage());
}
}
}
var request = require("request");
var options = {
method: 'GET',
url: 'https://sandbox-api.postmen.com/v3/labels',
headers: {
'content-type': 'application/json',
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$url = 'https://sandbox-api.postmen.com/v3/labels';
$method = 'GET';
$headers = array(
"content-type: application/json",
"postmen-api-key: 8fc7966b-679b-4a57-911d-c5a663229c9e"
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
# Make sure to install requests: pip install requests
import requests
url = 'https://sandbox-api.postmen.com/v3/labels'
headers = {
'postmen-api-key': '8fc7966b-679b-4a57-911d-c5a663229c9e',
'content-type': 'application/json'
}
response = requests.request('GET', url, headers=headers)
print(response.text)
require 'uri'
require 'net/http'
url = URI('https://sandbox-api.postmen.com/v3/labels')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request['postmen-api-key'] = '8fc7966b-679b-4a57-911d-c5a663229c9e'
request['content-type'] = 'application/json'
response = http.request(request)
puts response.read_body
Name | Type | Description |
---|---|---|
next_token | string or null | Any of string or null |
limit | number | Number of records per page |
labels | array of a label object | A label object |
Response example
{
"meta": {
"code": 200,
"message": "OK",
"details": []
},
"data": {
"next_token": "eyJjcmVhdGVkX2F0IjoiMjAxNS0xMS0y0000000000oyMC4wNjRaIiwiaWQiOiJlMGU1NGQ3My1iN2Qz0000000000kzZi1lMjgwNzc1ZDdlMDUiLCJ1c2VyX2lkIjoiN0000000000tNjIyNS00ZTBiLTg5ZTQtZTM3N2M3YWM5ZDk4In0=",
"limit": 20,
"created_at_min": "2019-05-26T08:49:15+00:00",
"created_at_max": "2019-05-27T08:49:15+00:00",
"labels": [
{
"id": "ca62aa0d-e8b2-4ea7-b3b1-ee6711d8d7c3",
"status": "created",
"tracking_numbers": [
"1ZV8E0536793432874"
],
"files": {
"label": {
"paper_size": "4x6",
"url": "https://sandbox-download.postmen.com/label/2019-05-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-05-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"customs_declaration": null,
"manifest": null
},
"rate": {
"charge_weight": null,
"total_charge": null,
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "newgistics",
"description": "newgistics"
},
"service_type": "newgistics_parcel_select",
"service_name": "Parcel Select",
"info_message": "No rate quotes returned from carrier."
},
"created_at": "2019-05-27T08:48:31+00:00",
"updated_at": "2019-05-27T08:48:35+00:00"
},
{
"id": "e0e54d73-b7d3-4972-893f-e280775d7e05",
"status": "created",
"tracking_numbers": [
"49950452315"
],
"files": {
"label": {
"paper_size": "4x6",
"url": "https://sandbox-download.postmen.com/label/2019-05-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"invoice": {
"paper_size": "a4",
"url": "https://sandbox-download.postmen.com/invoice/2019-05-27/00000000-0000-0000-0000-000000000000-1441785264309885.pdf",
"file_type": "pdf"
},
"customs_declaration": null,
"manifest": null
},
"rate": {
"charge_weight": null,
"total_charge": null,
"shipper_account": {
"id": "00000000-0000-0000-0000-000000000000",
"slug": "newgistics",
"description": "newgistics"
},
"service_type": "newgistics_parcel_select",
"service_name": "Parcel Select",
"info_message": "No rate quotes returned from carrier."
},
"created_at": "2019-05-27T08:24:20+00:00",
"updated_at": "2019-05-27T08:24:23+00:00"
}
]
}
}