Connect Carrier Accounts
The ShipEngine Connect Carrier APIs allow you to connect existing carrier accounts to your ShipEngine API account(s) programmatically via the API without having to log in to the ShipEngine API dashboard. This is a useful functionality if you have wrapped a custom UI around the ShipEngine API toolset, and want to be able to add or disconnect existing carrier accounts without exposing your end users to the API dashboard.
These APIs can be used in parallel with the ShipEngine Partner APIs to programmatically create new ShipEngine users, and then connect existing carrier accounts all via the API without logging into a dashboard. Together these APIs empower you to completely white label the ShipEngine experience for your end user.
To learn more about the ShipEngine Partner APIs, please reach out to your ShipEngine Account Manager
Access Worldwide
Access Worldwide Account Information Model
Property | Description |
---|---|
nickname |
string, required |
username |
string, required |
password |
string, required |
Connect an Access Worldwide account
POST /v1/connections/carriers/access_worldwide
POST /v1/connections/carriers/access_worldwide HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "Test Access Worldwide Account",
"username": "your_username_here",
"password": "your_password_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/access_worldwide \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "Test Access Worldwide Account",
"username": "your_username_here",
"password": "your_password_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"Test Access Worldwide Account`",`n `"username`": `"your_username_here`",`n `"password`": `"your_password_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/access_worldwide' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"Test Access Worldwide Account","username":"your_username_here","password":"your_password_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/access_worldwide", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/access_worldwide',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"Test Access Worldwide Account","username":"your_username_here","password":"your_password_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/access_worldwide",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/access_worldwide"
payload = "{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/access_worldwide")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/access_worldwide");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/access_worldwide")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/access_worldwide"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/access_worldwide"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"Test Access Worldwide Account\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/access_worldwide")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Access Worldwide account
DELETE /v1/connections/carriers/access_worldwide/:id
DELETE /v1/connections/carriers/access_worldwide/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/access_worldwide/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
APC
APC Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
Connect an APC Account
POST /v1/connections/carriers/apc
POST /v1/connections/carriers/apc HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my apc account",
"username": "usernameapc",
"password": "pa55word"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/apc \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my apc account",
"username": "usernameapc",
"password": "pa55word"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my apc account`",`n `"username`": `"usernameapc`",`n `"password`": `"pa55word`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/apc' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my apc account","username":"usernameapc","password":"pa55word"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/apc", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/apc',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my apc account","username":"usernameapc","password":"pa55word"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/apc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/apc"
payload = "{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/apc")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/apc");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/apc")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/apc"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/apc"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my apc account\",\n \"username\": \"usernameapc\",\n \"password\": \"pa55word\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/apc")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an APC Account
DELETE v1/connections/carriers/apc/:id
DELETE /v1/connections/carriers/ HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/ \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Asendia
Asendia Account Information Model
Property | Description |
---|---|
nickname | string, required |
ftp_username | string, required |
ftp_password | string, required |
account_number | int, required |
Connect an Asendia Account
POST /v1/connections/carriers/asendia
POST /v1/connections/carriers/asendia HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my asendia account",
"ftp_username": "userasendia",
"ftp_password": "pa55word",
"account_number": 1234
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/asendia \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my asendia account",
"ftp_username": "userasendia",
"ftp_password": "pa55word",
"account_number": 1234
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my asendia account`",`n `"ftp_username`": `"userasendia`",`n `"ftp_password`": `"pa55word`",`n `"account_number`": 1234`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/asendia' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my asendia account","ftp_username":"userasendia","ftp_password":"pa55word","account_number":1234});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/asendia", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/asendia',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my asendia account","ftp_username":"userasendia","ftp_password":"pa55word","account_number":1234})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/asendia",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/asendia"
payload = "{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/asendia")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/asendia");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/asendia")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/asendia"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/asendia"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my asendia account\",\n \"ftp_username\": \"userasendia\",\n \"ftp_password\": \"pa55word\",\n \"account_number\": 1234\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/asendia")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an Asendia Account
DELETE /v1/connections/carriers/asendia/:id
DELETE /v1/connections/carriers/asendia/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/asendia/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/asendia/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/asendia/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/asendia/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/asendia/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/asendia/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/asendia/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/asendia/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/asendia/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/asendia/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/asendia/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/asendia/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Australia Post
Australia Post Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
api_key | string, required |
api_secret | string, required |
Connect an Australia Post Account
POST /v1/connections/carriers/australia_post
POST /v1/connections/carriers/australia_post HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my australia post account",
"account_number": "123456789",
"api_key": "your_api_key_here",
"api_secret": "your_api_secret_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/australia_post \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my australia post account",
"account_number": "123456789",
"api_key": "your_api_key_here",
"api_secret": "your_api_secret_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my australia post account`",`n `"account_number`": `"123456789`",`n `"api_key`": `"your_api_key_here`",`n `"api_secret`": `"your_api_secret_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/australia_post' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my australia post account","account_number":"123456789","api_key":"your_api_key_here","api_secret":"your_api_secret_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/australia_post", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/australia_post',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my australia post account","account_number":"123456789","api_key":"your_api_key_here","api_secret":"your_api_secret_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/australia_post",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/australia_post"
payload = "{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/australia_post")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/australia_post");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/australia_post")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/australia_post"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/australia_post"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my australia post account\",\n \"account_number\": \"123456789\",\n \"api_key\": \"your_api_key_here\",\n \"api_secret\": \"your_api_secret_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/australia_post")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an Australia Post Account
DELETE /v1/connections/carriers/australia_post/:id
DELETE /v1/connections/carriers/australia_post/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/australia_post/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Canpar (CA)
Canpar Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
account_number | string, required |
Connect a Canpar Account
POST /v1/connections/carriers/canpar
POST /v1/connections/carriers/canpar HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Canpar Account",
"username": "username",
"password": "pa55word",
"account_number": "12345"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/canpar \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Canpar Account",
"username": "username",
"password": "pa55word",
"account_number": "12345"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Canpar Account`",`n `"username`": `"username`",`n `"password`": `"pa55word`",`n `"account_number`": `"12345`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/canpar' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Canpar Account","username":"username","password":"pa55word","account_number":"12345"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/canpar", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/canpar',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Canpar Account","username":"username","password":"pa55word","account_number":"12345"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/canpar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/canpar"
payload = "{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/canpar")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/canpar");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/canpar")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/canpar"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/canpar"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Canpar Account\",\n \"username\": \"username\",\n \"password\": \"pa55word\",\n \"account_number\": \"12345\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/canpar")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Canpar Account
DELETE /v1/connections/carriers/canpar/:id
DELETE /v1/connections/carriers/canpar/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/canpar/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Couriers Please
Couriers Please Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
auth_token | string, required |
Connect a Couriers Please Account
POST /v1/connections/carriers/couriers_please
POST /v1/connections/carriers/couriers_please HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Couriers Please Account",
"account_number": "123456789",
"auth_token": "your_auth_token_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/couriers_please \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Couriers Please Account",
"account_number": "123456789",
"auth_token": "your_auth_token_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Couriers Please Account`",`n `"account_number`": `"123456789`",`n `"auth_token`": `"your_auth_token_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/couriers_please' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Couriers Please Account","account_number":"123456789","auth_token":"your_auth_token_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/couriers_please", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/couriers_please',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Couriers Please Account","account_number":"123456789","auth_token":"your_auth_token_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/couriers_please",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/couriers_please"
payload = "{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/couriers_please")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/couriers_please");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/couriers_please")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/couriers_please"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/couriers_please"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Couriers Please Account\",\n \"account_number\": \"123456789\",\n \"auth_token\": \"your_auth_token_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/couriers_please")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Couriers Please Account
DELETE /v1/connections/carriers/couriers_please/:id
DELETE /v1/connections/carriers/couriers_please/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/couriers_please/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL E-Commerce
info
Important info about rates
DHL E-commerce supports rating but only if you have DHL eCommerce API Credentials. Please contact your DHL account representative for more information.
DHL E-Commerce Account Information Model
Property | Description |
---|---|
nickname |
string, required |
client_id |
string, required |
username |
string, required |
password |
string, required |
pickup_number |
string, required |
distribution_center |
string, required |
api_key |
string |
api_secret |
string |
Connect a DHL E-Commerce account
POST /v1/connections/carriers/dhl_ecommerce
POST /v1/connections/carriers/dhl_ecommerce HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "Test DHL E-Commerce Account",
"client_id": "123456",
"username": "your_username_here",
"password": "your_password_here",
"pickup_number" : "123456789",
"distribution_center" : "USDFW1",
"api_key" : "your_api_key_here",
"api_secret" : "your_api_secret_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "Test DHL E-Commerce Account",
"client_id": "123456",
"username": "your_username_here",
"password": "your_password_here",
"pickup_number" : "123456789",
"distribution_center" : "USDFW1",
"api_key" : "your_api_key_here",
"api_secret" : "your_api_secret_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"Test DHL E-Commerce Account`",`n `"client_id`": `"123456`",`n `"username`": `"your_username_here`",`n `"password`": `"your_password_here`",`n `"pickup_number`" : `"123456789`",`n `"distribution_center`" : `"USDFW1`",`n `"api_key`" : `"your_api_key_here`",`n `"api_secret`" : `"your_api_secret_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"Test DHL E-Commerce Account","client_id":"123456","username":"your_username_here","password":"your_password_here","pickup_number":"123456789","distribution_center":"USDFW1","api_key":"your_api_key_here","api_secret":"your_api_secret_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"Test DHL E-Commerce Account","client_id":"123456","username":"your_username_here","password":"your_password_here","pickup_number":"123456789","distribution_center":"USDFW1","api_key":"your_api_key_here","api_secret":"your_api_secret_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce"
payload = "{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"Test DHL E-Commerce Account\",\n \"client_id\": \"123456\",\n \"username\": \"your_username_here\",\n \"password\": \"your_password_here\",\n \"pickup_number\" : \"123456789\",\n \"distribution_center\" : \"USDFW1\",\n \"api_key\" : \"your_api_key_here\",\n \"api_secret\" : \"your_api_secret_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a DHL E-Commerce account
DELETE /v1/connections/carriers/dhl_ecommerce/:id
DELETE /v1/connections/carriers/dhl_ecommerce/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_ecommerce/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL and DHL E-Commerce service marks are owned by Deutsche Post DHL Group and used with permission.
DHL Express AU
DHL Express AU Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
Connect DHL Express AU
POST /v1/connections/carriers/dhl_express_au
POST /v1/connections/carriers/dhl_express_au HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my dhl account",
"account_number": "123456789"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dhl_express_au \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my dhl account",
"account_number": "123456789"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my dhl account`",`n `"account_number`": `"123456789`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_au' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my dhl account","account_number":"123456789"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_au", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_au',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my dhl account","account_number":"123456789"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_au",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_au"
payload = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_au")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_au");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_au")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_au"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_au"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_au")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect DHL Express AU
DELETE v1/connections/carriers/dhl_express_au/:id
DELETE /v1/connections/carriers/dhl_express_au/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_au/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL and DHL Express AU service marks are owned by Deutsche Post DHL Group and used with permission.
DHL Express CA
DHL Express CA Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
Connect a DHL Express CA account
POST /v1/connections/carriers/dhl_express_ca
POST /v1/connections/carriers/dhl_express_ca HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my dhl account",
"account_number": "123456789"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dhl_express_ca \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my dhl account",
"account_number": "123456789"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my dhl account`",`n `"account_number`": `"123456789`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_ca' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my dhl account","account_number":"123456789"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_ca',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my dhl account","account_number":"123456789"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca"
payload = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_ca"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a DHL Express CA account
DELETE /v1/connections/carriers/dhl_express_ca/:id
DELETE /v1/connections/carriers/dhl_express_ca/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_ca/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL and DHL Express CA service marks are owned by Deutsche Post DHL Group and used with permission.
DHL Express UK
DHL Express UK Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
site_id | string, required |
password | string, required |
Connect a DHL Express UK Account
POST /v1/connections/carriers/dhl_express_uk
POST /v1/connections/carriers/dhl_express_uk HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my dhl account",
"account_number": "123456789",
"site_id": "ExampleId",
"password": "password123"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dhl_express_uk \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my dhl account",
"account_number": "123456789",
"site_id": "ExampleId",
"password": "password123"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my dhl account`",`n `"account_number`": `"123456789`",`n `"site_id`": `"ExampleId`",`n `"password`": `"password123`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_uk' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my dhl account","account_number":"123456789","site_id":"ExampleId","password":"password123"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_uk',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my dhl account","account_number":"123456789","site_id":"ExampleId","password":"password123"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk"
payload = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_uk"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\",\n \"site_id\": \"ExampleId\",\n \"password\": \"password123\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a DHL Express UK Account
DELETE /v1/connections/carriers/dhl_express_uk/:id
DELETE /v1/connections/carriers/dhl_express_uk/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express_uk/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL and DHL Express UK service marks are owned by Deutsche Post DHL Group and used with permission.
DHL Express
DHL Express Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
Connect a DHL Express account
POST /v1/connections/carriers/dhl_express
POST /v1/connections/carriers/dhl_express HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my dhl account",
"account_number": "123456789"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dhl_express \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my dhl account",
"account_number": "123456789"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my dhl account`",`n `"account_number`": `"123456789`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my dhl account","account_number":"123456789"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my dhl account","account_number":"123456789"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express"
payload = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my dhl account\",\n \"account_number\": \"123456789\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Modify DHL Express Settings
Hide Account Number in Archive Document
Parameter | Description |
---|---|
should_hide_account_number_on_archive_doc | boolean |
PUT /v1/connections/carriers/dhl_express/:dhl_id/settings
PUT /v1/connections/carriers/ups/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"should_hide_account_number_on_archive_doc": true
}
curl -iX PUT https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"should_hide_account_number_on_archive_doc": true
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"should_hide_account_number_on_archive_doc`": true`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings' -Method 'PUT' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"should_hide_account_number_on_archive_doc":true});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"should_hide_account_number_on_archive_doc":true})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS =>"{\n \"should_hide_account_number_on_archive_doc\": true\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
payload = "{\n \"should_hide_account_number_on_archive_doc\": true\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"should_hide_account_number_on_archive_doc\": true\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"should_hide_account_number_on_archive_doc\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"should_hide_account_number_on_archive_doc\": true\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
.method("PUT", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
method := "PUT"
payload := strings.NewReader("{\n \"should_hide_account_number_on_archive_doc\": true\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"should_hide_account_number_on_archive_doc\": true\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"should_hide_account_number_on_archive_doc\": true\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "PUT"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
GET /v1/connections/carriers/dhl_express/:dhl_id/settings
GET /v1/connections/carriers/dhl_express/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX GET https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings' -Method 'GET' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings")
.method("GET", null)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"nickname": "my dhl_express account",
"should_hide_account_number_on_archive_doc": false,
"is_primary_account": true
}
{
"nickname": "my dhl_express account",
"should_hide_account_number_on_archive_doc": false,
"is_primary_account": true
}
Disconnect a DHL Express account
DELETE /v1/connections/carriers/dhl_express/:id
DELETE /v1/connections/carriers/dhl_express/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dhl_express/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DHL and DHL Express service marks are owned by Deutsche Post DHL Group and used with permission.
DPD
DPD Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
password | string, required |
Connect a DPD account
POST /v1/connections/carriers/dpd
POST /v1/connections/carriers/dpd HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my DPD account",
"account_number": "123456789",
"password": "password123"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dpd \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my DPD account",
"account_number": "123456789",
"password": "password123"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my DPD account`",`n `"account_number`": `"123456789`",`n `"password`": `"password123`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dpd' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my DPD account","account_number":"123456789","password":"password123"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dpd", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dpd',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my DPD account","account_number":"123456789","password":"password123"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dpd",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dpd"
payload = "{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dpd")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dpd");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dpd")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dpd"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dpd"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my DPD account\",\n \"account_number\": \"123456789\",\n \"password\": \"password123\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dpd")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a DPD Local account
DELETE /v1/connections/carriers/dpd-local/:id
DELETE /v1/connections/carriers/dpd-local/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dpd-local/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
DPD Local
DPD Local Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
Connect a DPD Local account
POST /v1/connections/carriers/dpd-local
POST /v1/connections/carriers/dpd_local HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my DPD Local account",
"username": "123456789",
"password": "password123"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/dpd_local \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my DPD Local account",
"username": "123456789",
"password": "password123"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my DPD Local account`",`n `"username`": `"123456789`",`n `"password`": `"password123`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dpd_local' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my DPD Local account","username":"123456789","password":"password123"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dpd_local", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/dpd_local',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my DPD Local account","username":"123456789","password":"password123"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dpd_local",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dpd_local"
payload = "{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dpd_local")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dpd_local");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dpd_local")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dpd_local"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dpd_local"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my DPD Local account\",\n \"username\": \"123456789\",\n \"password\": \"password123\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dpd_local")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a DPD Local account
DELETE /v1/connections/carriers/dpd_local/:id
DELETE /v1/connections/carriers/dpd_local/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/dpd_local/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Endicia
Endicia Account Information Model
Property | Description |
---|---|
nickname | string, required |
account | string, required |
passphrase | string, required |
Connect an Endicia Account
POST /v1/connections/carriers/endicia
POST /v1/connections/carriers/endicia HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Endicia account",
"account": "__YOUR_USERNAME_HERE__",
"passphrase": "__YOUR_PASSWORD_HERE__"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/endicia \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Endicia account",
"account": "__YOUR_USERNAME_HERE__",
"passphrase": "__YOUR_PASSWORD_HERE__"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Endicia account`",`n `"account`": `"__YOUR_USERNAME_HERE__`",`n `"passphrase`": `"__YOUR_PASSWORD_HERE__`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/endicia' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Endicia account","account":"__YOUR_USERNAME_HERE__","passphrase":"__YOUR_PASSWORD_HERE__"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/endicia", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/endicia',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Endicia account","account":"__YOUR_USERNAME_HERE__","passphrase":"__YOUR_PASSWORD_HERE__"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/endicia",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/endicia"
payload = "{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/endicia")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/endicia");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/endicia")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/endicia"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/endicia"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Endicia account\",\n \"account\": \"__YOUR_USERNAME_HERE__\",\n \"passphrase\": \"__YOUR_PASSWORD_HERE__\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/endicia")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an Endicia Account
DELETE /v1/connections/carriers/endicia/:id
DELETE /v1/connections/carriers/endicia/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/endicia/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/endicia/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/endicia/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/endicia/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/endicia/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/endicia/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/endicia/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/endicia/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/endicia/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/endicia/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/endicia/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/endicia/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Fastway AU
Fastway AU Account Information Model
Property | Description |
---|---|
nickname | string, required |
client_id | string, required |
client_secret | string, required |
string, required |
Connect a Fastway AU Account
POST /v1/connections/carriers/fastway_au
POST /v1/connections/carriers/fastway_au HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Fastway AU Account",
"client_id": "myclient-id",
"client_secret": "mysecret",
"email": "[email protected]"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/fastway_au \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Fastway AU Account",
"client_id": "myclient-id",
"client_secret": "mysecret",
"email": "[email protected]"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Fastway AU Account`",`n `"client_id`": `"myclient-id`",`n `"client_secret`": `"mysecret`",`n `"email`": `"[email protected]`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fastway_au' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Fastway AU Account","client_id":"myclient-id","client_secret":"mysecret","email":"[email protected]"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fastway_au", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/fastway_au',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Fastway AU Account","client_id":"myclient-id","client_secret":"mysecret","email":"[email protected]"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fastway_au",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fastway_au"
payload = "{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fastway_au")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fastway_au");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fastway_au")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fastway_au"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fastway_au"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Fastway AU Account\",\n \"client_id\": \"myclient-id\",\n \"client_secret\": \"mysecret\",\n \"email\": \"[email protected]\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fastway_au")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Fastway AU Account
DELETE /v1/connections/carriers/fastway_au/:id
DELETE /v1/connections/carriers/fastway_au/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fastway_au/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
FedEx UK
info
Terms of Service
By connecting a FedEx UK account, you and your users agree to the FedEx EULA.
FedEx UK Account Information Model
Property | Description |
---|---|
nickname | string, required A nickname for your account in ShipEngine. Very useful if you have multiple accounts for the same carrier. |
account_number | string, required |
first_name | string, required |
last_name | string, required |
company | string |
address1 | string, required |
address2 | string |
city | string, required |
postal_code | string, required |
country_code | string, required |
string, required | |
phone | string, required |
agree_to_eula | bool, required |
Connect a Fedex account
POST /v1/connections/carriers/fedex_uk
POST /v1/connections/carriers/fedex_uk HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My FedEx UK account",
"account_number": "123456789",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"phone": "20 5555 5555",
"address1": "77 Netherpark Crescent",
"address2": "Suite 100",
"city": "London",
"postal_code": "ABC 123",
"country_code": "GB",
"email": "[email protected]",
"agree_to_eula": "true"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/fedex_uk \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My FedEx UK account",
"account_number": "123456789",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"phone": "20 5555 5555",
"address1": "77 Netherpark Crescent",
"address2": "Suite 100",
"city": "London",
"postal_code": "ABC 123",
"country_code": "GB",
"email": "[email protected]",
"agree_to_eula": "true"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My FedEx UK account`",`n `"account_number`": `"123456789`",`n `"company`": `"Example Corp.`",`n `"first_name`": `"John`",`n `"last_name`": `"Doe`",`n `"phone`": `"20 5555 5555`",`n `"address1`": `"77 Netherpark Crescent`",`n `"address2`": `"Suite 100`",`n `"city`": `"London`",`n `"postal_code`": `"ABC 123`",`n `"country_code`": `"GB`",`n `"email`": `"[email protected]`",`n `"agree_to_eula`": `"true`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex_uk' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My FedEx UK account","account_number":"123456789","company":"Example Corp.","first_name":"John","last_name":"Doe","phone":"20 5555 5555","address1":"77 Netherpark Crescent","address2":"Suite 100","city":"London","postal_code":"ABC 123","country_code":"GB","email":"[email protected]","agree_to_eula":"true"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex_uk", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex_uk',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My FedEx UK account","account_number":"123456789","company":"Example Corp.","first_name":"John","last_name":"Doe","phone":"20 5555 5555","address1":"77 Netherpark Crescent","address2":"Suite 100","city":"London","postal_code":"ABC 123","country_code":"GB","email":"[email protected]","agree_to_eula":"true"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex_uk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex_uk"
payload = "{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex_uk")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex_uk");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex_uk")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex_uk"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex_uk"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My FedEx UK account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"20 5555 5555\",\n \"address1\": \"77 Netherpark Crescent\",\n \"address2\": \"Suite 100\",\n \"city\": \"London\",\n \"postal_code\": \"ABC 123\",\n \"country_code\": \"GB\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex_uk")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Fedex account
DELETE /v1/connections/carriers/fedex_uk/:id
DELETE /v1/connections/carriers/fedex_uk/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex_uk/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
FedEx service marks are owned by Federal Express Corporation and used with permission.
FedEx US and CA
info
Terms of Service
By connecting a FedEx US or CA account, you and your users agree to the FedEx EULA.
FedEx Account Information Model
Property | Description |
---|---|
nickname | string, required A nickname for your account in ShipEngine. Very useful if you have multiple accounts for the same carrier. |
account_number | string, required |
first_name | string, required |
last_name | string, required |
company | string |
address1 | string, required |
address2 | string |
city | string, required |
state_province | string, required |
postal_code | string, required |
country_code | string, required |
string, required | |
phone | string, required |
agree_to_eula | bool, required |
Connect a Fedex US and CA account
POST /v1/connections/carriers/fedex
POST /v1/connections/carriers/fedex HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My FedEx account",
"account_number": "123456789",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"phone": "111-111-1111",
"address1": "4009 Marathon Blvd.",
"address2": "Suite 300",
"city": "Austin",
"state": "TX",
"postal_code": "78756",
"country_code": "US",
"email": "[email protected]",
"agree_to_eula": "true"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/fedex \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My FedEx account",
"account_number": "123456789",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"phone": "111-111-1111",
"address1": "4009 Marathon Blvd.",
"address2": "Suite 300",
"city": "Austin",
"state": "TX",
"postal_code": "78756",
"country_code": "US",
"email": "[email protected]",
"agree_to_eula": "true"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My FedEx account`",`n `"account_number`": `"123456789`",`n `"company`": `"Example Corp.`",`n `"first_name`": `"John`",`n `"last_name`": `"Doe`",`n `"phone`": `"111-111-1111`",`n `"address1`": `"4009 Marathon Blvd.`",`n `"address2`": `"Suite 300`",`n `"city`": `"Austin`",`n `"state`": `"TX`",`n `"postal_code`": `"78756`",`n `"country_code`": `"US`",`n `"email`": `"[email protected]`",`n `"agree_to_eula`": `"true`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My FedEx account","account_number":"123456789","company":"Example Corp.","first_name":"John","last_name":"Doe","phone":"111-111-1111","address1":"4009 Marathon Blvd.","address2":"Suite 300","city":"Austin","state":"TX","postal_code":"78756","country_code":"US","email":"[email protected]","agree_to_eula":"true"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My FedEx account","account_number":"123456789","company":"Example Corp.","first_name":"John","last_name":"Doe","phone":"111-111-1111","address1":"4009 Marathon Blvd.","address2":"Suite 300","city":"Austin","state":"TX","postal_code":"78756","country_code":"US","email":"[email protected]","agree_to_eula":"true"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex"
payload = "{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My FedEx account\",\n \"account_number\": \"123456789\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"phone\": \"111-111-1111\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"email\": \"[email protected]\",\n \"agree_to_eula\": \"true\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Modify FedEx Settings
ShipEngine takes advantage of some of FedEx's advanced functionality but does not enable it by default.
Pickup Type
Parameter | Type | Description |
---|---|---|
pickup_type | enumerated string | Determines how FedEx will pickup your packagesnone - Not specifiedregular_pickup - You already have a daily pickup scheduled with FedExrequest_courier - You will call FedEx to request a courierdrop_box - You will drop-off packages in a FedEx drop boxbusiness_service_center - You will drop-off packages at an authorized FedEx business service centerstation - You will drop-off the package at a FedEx Station |
FedEx SmartPost™
FedEx makes documentation available for SmartPost™ here.
Info
Enabling SmartPost™
To enable SmartPost™ both of the properties below are required and must be valid.
Parameter | Description |
---|---|
smart_post_hub | enumerated string none , allentown_pa , atlanta_ga , charlotte_nc , chino_ca , dallas_tx , denver_co , detroit_mi , edison_nj , grove_city_oh , groveport_oh , houston_tx , indianapolis_in , kansas_city_ks , los_angeles_ca , martinsburg_wv , memphis_tn , minneapolis_mn , new_berlin_wi , northborough_ma , orlando_fl , phoneix_az , pittsburgh_pa , reno_nv , sacramento_ca , salt_lake_city_ut , seattle_wa , st_louis_mo |
smart_post_endorsement | enumerated string none , return_service_requested , forwarding_service_requested , address_service_requested , change_service_requested , leave_if_no_response |
Common Settings
Parameter | Description |
---|---|
nickname | string Nickname for the account that will appear on carrier calls and in the UI. |
is_primary_account | bool Whether or not the account is set to primary, this currently has no function inside of ShipEngine. |
PUT /v1/connections/carriers/fedex/:carrier_id/settings
PUT /v1/connections/carriers/fedex/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my fedex account",
"pickup_type": "regular_pickup",
"smart_post_hub": "dallas_tx",
"smart_post_endorsement": "address_service_requested",
"is_primary_account": "false"
}
curl -iX PUT https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my fedex account",
"pickup_type": "regular_pickup",
"smart_post_hub": "dallas_tx",
"smart_post_endorsement": "address_service_requested",
"is_primary_account": "false"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my fedex account`",`n `"pickup_type`": `"regular_pickup`",`n `"smart_post_hub`": `"dallas_tx`",`n `"smart_post_endorsement`": `"address_service_requested`",`n `"is_primary_account`": `"false`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings' -Method 'PUT' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my fedex account","pickup_type":"regular_pickup","smart_post_hub":"dallas_tx","smart_post_endorsement":"address_service_requested","is_primary_account":"false"});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my fedex account","pickup_type":"regular_pickup","smart_post_hub":"dallas_tx","smart_post_endorsement":"address_service_requested","is_primary_account":"false"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"
payload = "{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")
.method("PUT", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"
method := "PUT"
payload := strings.NewReader("{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my fedex account\",\n \"pickup_type\": \"regular_pickup\",\n \"smart_post_hub\": \"dallas_tx\",\n \"smart_post_endorsement\": \"address_service_requested\",\n \"is_primary_account\": \"false\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "PUT"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
On a successful response, you will receive an HTTP status 204.
GET /v1/connections/carriers/fedex/:carrier_id/settings
GET /v1/connections/carriers/fedex/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX GET https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings' -Method 'GET' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")
.method("GET", null)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"nickname": "my fedex account",
"pickup_type": "none",
"smart_post_hub": "none",
"smart_post_endorsement": "none",
"is_primary_account": true
}
{
"nickname": "my fedex account",
"pickup_type": "none",
"smart_post_hub": "none",
"smart_post_endorsement": "none",
"is_primary_account": true
}
Disconnect a Fedex US and CA account
DELETE /v1/connections/carriers/fedex/:ID
DELETE /v1/connections/carriers/fedex/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/fedex/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/fedex/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/fedex/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/fedex/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/fedex/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/fedex/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/fedex/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/fedex/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/fedex/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/fedex/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/fedex/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/fedex/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
When FedEx has been successfully disconnected, you will receive a HTTP 204, No Content status.
FedEx service marks are owned by Federal Express Corporation and used with permission.
First Mile
First Mile Account Information Model
Property | Description |
---|---|
nickname | string, required |
mailer_id | string, required |
password | string, required |
Connect a First Mile account
POST /v1/connections/carriers/firstmile
POST /v1/connections/carriers/firstmile HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my firstmile account",
"mailer_id": "1234",
"password": "pa55word"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/firstmile \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my firstmile account",
"mailer_id": "1234",
"password": "pa55word"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my firstmile account`",`n `"mailer_id`": `"1234`",`n `"password`": `"pa55word`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/firstmile' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my firstmile account","mailer_id":"1234","password":"pa55word"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/firstmile", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/firstmile',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my firstmile account","mailer_id":"1234","password":"pa55word"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/firstmile",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/firstmile"
payload = "{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/firstmile")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/firstmile");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/firstmile")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/firstmile"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/firstmile"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my firstmile account\",\n \"mailer_id\": \"1234\",\n \"password\": \"pa55word\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/firstmile")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a First Mile account
DELETE /v1/connections/carriers/firstmile/:id
DELETE /v1/connections/carriers/firstmile/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/firstmile/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Globegistics
Globegistics Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
Connect a Globegistics Account
POST /v1/connections/carriers/globegistics
POST /v1/connections/carriers/globegistics HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my globegistics account",
"username": "userglobe",
"password": "pa55word"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/globegistics \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my globegistics account",
"username": "userglobe",
"password": "pa55word"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my globegistics account`",`n `"username`": `"userglobe`",`n `"password`": `"pa55word`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/globegistics' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my globegistics account","username":"userglobe","password":"pa55word"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/globegistics", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/globegistics',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my globegistics account","username":"userglobe","password":"pa55word"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/globegistics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/globegistics"
payload = "{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/globegistics")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/globegistics");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/globegistics")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/globegistics"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/globegistics"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my globegistics account\",\n \"username\": \"userglobe\",\n \"password\": \"pa55word\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/globegistics")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Globegistics Account
DELETE /v1/connections/carriers/globegistics/:id
DELETE /v1/connections/carriers/globegistics/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/globegistics/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Hermes
Hermes Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
client_id | string, required |
client_name | string, required |
endpoint ("Production" or "Testing") | string, required |
Connect an Hermes Account
POST /v1/connections/carriers/hermescorp
POST /v1/connections/carriers/hermescorp HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Hermes Account",
"username": "hermes_user",
"password": "pa55word",
"client_id": "12345",
"client_name": "Hermes User",
"endpoint": "Production"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/hermescorp \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Hermes Account",
"username": "hermes_user",
"password": "pa55word",
"client_id": "12345",
"client_name": "Hermes User",
"endpoint": "Production"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Hermes Account`",`n `"username`": `"hermes_user`",`n `"password`": `"pa55word`",`n `"client_id`": `"12345`",`n `"client_name`": `"Hermes User`",`n `"endpoint`": `"Production`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/hermescorp' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Hermes Account","username":"hermes_user","password":"pa55word","client_id":"12345","client_name":"Hermes User","endpoint":"Production"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/hermescorp", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/hermescorp',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Hermes Account","username":"hermes_user","password":"pa55word","client_id":"12345","client_name":"Hermes User","endpoint":"Production"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/hermescorp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/hermescorp"
payload = "{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/hermescorp")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/hermescorp");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/hermescorp")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/hermescorp"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/hermescorp"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Hermes Account\",\n \"username\": \"hermes_user\",\n \"password\": \"pa55word\",\n \"client_id\": \"12345\",\n \"client_name\": \"Hermes User\",\n \"endpoint\": \"Production\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/hermescorp")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an Hermes Account
DELETE /v1/connections/carriers/hermescorp/:id
DELETE /v1/connections/carriers/hermescorp/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/hermescorp/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Newgistics
Newgistics Account Information Model
Property | Description |
---|---|
nickname | string, required |
merchant_id | numeric, required |
mailer_id | string, required |
induction_site | string, required |
Connect a Newgistics Account
POST /v1/connections/carriers/newgistics
POST /v1/connections/carriers/newgistics HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my newgistics account",
"merchant_id": "123",
"mailer_id" : "345",
"induction_site" : "site"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/newgistics \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my newgistics account",
"merchant_id": "123",
"mailer_id" : "345",
"induction_site" : "site"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my newgistics account`",`n `"merchant_id`": `"123`",`n `"mailer_id`" : `"345`",`n `"induction_site`" : `"site`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/newgistics' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my newgistics account","merchant_id":"123","mailer_id":"345","induction_site":"site"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/newgistics", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/newgistics',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my newgistics account","merchant_id":"123","mailer_id":"345","induction_site":"site"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/newgistics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/newgistics"
payload = "{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/newgistics")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/newgistics");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/newgistics")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/newgistics"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/newgistics"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my newgistics account\",\n \"merchant_id\": \"123\",\n \"mailer_id\" : \"345\",\n \"induction_site\" : \"site\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/newgistics")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Newgistics Account
DELETE /v1/connections/carriers/newgistics/:id
DELETE /v1/connections/carriers/newgistics/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/newgistics/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Landmark Global
Landmark Global Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
client_id | string, required |
Connect a Landmark Global Account
POST /v1/connections/carriers/landmark_global
POST /v1/connections/carriers/landmark_global HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my landmark_global account",
"username": "username",
"password": "password",
"client_id" : "client_id"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/landmark_global \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my landmark_global account",
"username": "username",
"password": "password",
"client_id" : "client_id"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my landmark_global account`",`n `"username`": `"username`",`n `"password`": `"password`",`n `"client_id`" : `"client_id`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/landmark_global' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my landmark_global account","username":"username","password":"password","client_id":"client_id"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/landmark_global", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/landmark_global',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my landmark_global account","username":"username","password":"password","client_id":"client_id"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/landmark_global",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/landmark_global"
payload = "{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/landmark_global")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/landmark_global");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/landmark_global")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/landmark_global"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/landmark_global"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my landmark_global account\",\n \"username\": \"username\",\n \"password\": \"password\",\n \"client_id\" : \"client_id\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/landmark_global")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Landmark Global Account
DELETE /v1/connections/carriers/landmark_global/:id
DELETE /v1/connections/carriers/landmark_global/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/landmark_global/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
OnTrac
OnTrac Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | int, required |
password | string, required |
Connect an OnTrac Account
POST /v1/connections/carriers/ontrac
POST /v1/connections/carriers/ontrac HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my ontrac account",
"account_number": 1234,
"password": "pa55word"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/ontrac \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my ontrac account",
"account_number": 1234,
"password": "pa55word"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my ontrac account`",`n `"account_number`": 1234,`n `"password`": `"pa55word`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ontrac' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my ontrac account","account_number":1234,"password":"pa55word"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ontrac", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/ontrac',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my ontrac account","account_number":1234,"password":"pa55word"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ontrac",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ontrac"
payload = "{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ontrac")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ontrac");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ontrac")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ontrac"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ontrac"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my ontrac account\",\n \"account_number\": 1234,\n \"password\": \"pa55word\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ontrac")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect an OnTrac Account
DELETE /v1/connections/carriers/ontrac/:id
DELETE /v1/connections/carriers/ontrac/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ontrac/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Parcelforce
Parcelforce Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
password | string, required |
sftp_username | string, required |
sftp_password | string, required |
contract_number | string, required |
department_id | string, required |
test_account | boolean, required |
Connect a Parcelforce Account
POST /v1/connections/carriers/parcelforce
POST /v1/connections/carriers/parcelforce HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Parcelforce Account",
"account_number": "1234",
"password": "pa55word",
"sftp_username": "sftp_user",
"sftp_password": "pa55word",
"contract_number": "12345",
"department_id": "12",
"test_account": false
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/parcelforce \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Parcelforce Account",
"account_number": "1234",
"password": "pa55word",
"sftp_username": "sftp_user",
"sftp_password": "pa55word",
"contract_number": "12345",
"department_id": "12",
"test_account": false
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Parcelforce Account`",`n `"account_number`": `"1234`",`n `"password`": `"pa55word`",`n `"sftp_username`": `"sftp_user`",`n `"sftp_password`": `"pa55word`",`n `"contract_number`": `"12345`",`n `"department_id`": `"12`",`n `"test_account`": false`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/parcelforce' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Parcelforce Account","account_number":"1234","password":"pa55word","sftp_username":"sftp_user","sftp_password":"pa55word","contract_number":"12345","department_id":"12","test_account":false});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/parcelforce", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/parcelforce',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Parcelforce Account","account_number":"1234","password":"pa55word","sftp_username":"sftp_user","sftp_password":"pa55word","contract_number":"12345","department_id":"12","test_account":false})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/parcelforce",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/parcelforce"
payload = "{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/parcelforce")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/parcelforce");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/parcelforce")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/parcelforce"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/parcelforce"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Parcelforce Account\",\n \"account_number\": \"1234\",\n \"password\": \"pa55word\",\n \"sftp_username\": \"sftp_user\",\n \"sftp_password\": \"pa55word\",\n \"contract_number\": \"12345\",\n \"department_id\": \"12\",\n \"test_account\": false\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/parcelforce")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Parcelforce Account
DELETE /v1/connections/carriers/parcelforce/:id
DELETE /v1/connections/carriers/parcelforce/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/parcelforce/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Purolator Canada
Purolator Canada Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
activation_key | string, required |
Connect a Purolator Canada Account
POST /v1/connections/carriers/purolator_canada
POST /v1/connections/carriers/purolator_canada HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "Test Purolator Canada Account",
"account_number": "1234567890",
"activation_key" : "abcdefgh-1234-ijkl-5678-mnopqrstuvwx"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/purolator_canada \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "Test Purolator Canada Account",
"account_number": "1234567890",
"activation_key" : "abcdefgh-1234-ijkl-5678-mnopqrstuvwx"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"Test Purolator Canada Account`",`n `"account_number`": `"1234567890`",`n `"activation_key`" : `"abcdefgh-1234-ijkl-5678-mnopqrstuvwx`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/purolator_canada' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"Test Purolator Canada Account","account_number":"1234567890","activation_key":"abcdefgh-1234-ijkl-5678-mnopqrstuvwx"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/purolator_canada", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/purolator_canada',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"Test Purolator Canada Account","account_number":"1234567890","activation_key":"abcdefgh-1234-ijkl-5678-mnopqrstuvwx"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/purolator_canada",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/purolator_canada"
payload = "{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/purolator_canada")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/purolator_canada");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/purolator_canada")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/purolator_canada"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/purolator_canada"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"Test Purolator Canada Account\",\n \"account_number\": \"1234567890\",\n \"activation_key\" : \"abcdefgh-1234-ijkl-5678-mnopqrstuvwx\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/purolator_canada")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Purolator Canada Account
DELETE /v1/connections/carriers/purolator_canada/:id
DELETE /v1/connections/carriers/purolator_canada/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/purolator_canada/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Royal Mail
info
Royal Mail
The Royal Mail connection process involves several manual steps. This connection request notifies both ShipEngine and Royal Mail. Your Royal Mail account will remain in an inactive
pending
state until Royal Mail sends ShipEngine your validated OBA Credentials.
Once ShipEngine has received your OBA Credentials from Royal Mail, your account will be configured. If you have services that use personalized tracking numbers, a request will be put in to Royal Mail to obtain tracking number ranges for your account. If you do not have personalized tracking ranges, you will be notified and your account will be activated. If a tracking range had to be requested, your account will be activated when Royal Mail sends back the valid ranges.
The credential verification process and the tracking range request process may take up to 5 business days each
When your Royal Mail carrier connection is fully activated and verified you will receive an email notification, a notification in the ShipEngine dashboard, and if you are subscribed, the API_CARRIER_CONNECTED webhook.
Royal Mail Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
oba_email | string, required |
contact_name | string, required |
string, required | |
street_line1 | string, required |
street_line2 | string |
city | string, required |
postal_code | string, required |
phone | string, required |
Connect a Royal Mail Account
POST /v1/connections/carriers/royal_mail
POST /v1/connections/carriers/royal_mail HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Royal Mail account",
"account_number": "123456789",
"oba_email" : "[email protected]",
"company_name": "Example Corp",
"contact_name": "John Doe",
"email": "[email protected]",
"street_line1": "77 Netherpark Crescent",
"street_line2": "",
"city": "STIRKOKE HOUSE",
"postal_code": "KW1 6LZ",
"phone": "215-555-5555"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/royal_mail \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Royal Mail account",
"account_number": "123456789",
"oba_email" : "[email protected]",
"company_name": "Example Corp",
"contact_name": "John Doe",
"email": "[email protected]",
"street_line1": "77 Netherpark Crescent",
"street_line2": "",
"city": "STIRKOKE HOUSE",
"postal_code": "KW1 6LZ",
"phone": "215-555-5555"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Royal Mail account`",`n `"account_number`": `"123456789`",`n `"oba_email`" : `"[email protected]`",`n `"company_name`": `"Example Corp`",`n `"contact_name`": `"John Doe`",`n `"email`": `"[email protected]`",`n `"street_line1`": `"77 Netherpark Crescent`",`n `"street_line2`": `"`",`n `"city`": `"STIRKOKE HOUSE`",`n `"postal_code`": `"KW1 6LZ`",`n `"phone`": `"215-555-5555`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/royal_mail' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Royal Mail account","account_number":"123456789","oba_email":"[email protected]","company_name":"Example Corp","contact_name":"John Doe","email":"[email protected]","street_line1":"77 Netherpark Crescent","street_line2":"","city":"STIRKOKE HOUSE","postal_code":"KW1 6LZ","phone":"215-555-5555"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/royal_mail", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/royal_mail',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Royal Mail account","account_number":"123456789","oba_email":"[email protected]","company_name":"Example Corp","contact_name":"John Doe","email":"[email protected]","street_line1":"77 Netherpark Crescent","street_line2":"","city":"STIRKOKE HOUSE","postal_code":"KW1 6LZ","phone":"215-555-5555"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/royal_mail",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/royal_mail"
payload = "{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/royal_mail")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/royal_mail");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/royal_mail")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/royal_mail"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/royal_mail"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Royal Mail account\",\n \"account_number\": \"123456789\",\n \"oba_email\" : \"[email protected]\",\n \"company_name\": \"Example Corp\",\n \"contact_name\": \"John Doe\",\n \"email\": \"[email protected]\",\n \"street_line1\": \"77 Netherpark Crescent\",\n \"street_line2\": \"\",\n \"city\": \"STIRKOKE HOUSE\",\n \"postal_code\": \"KW1 6LZ\",\n \"phone\": \"215-555-5555\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/royal_mail")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Royal Mail Account
DELETE /v1/connections/carriers/royal_mail/:id
DELETE /v1/connections/carriers/royal_mail/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/royal_mail/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
RR Donnelley
RR Donnelley Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
Connect a RR Donnelley Account
POST /v1/connections/carriers/rr_donnelley
POST /v1/connections/carriers/rr_donnelley HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my rr donnelley account",
"username": "donnelleyaccount",
"password": "pa55word"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/rr_donnelley \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my rr donnelley account",
"username": "donnelleyaccount",
"password": "pa55word"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my rr donnelley account`",`n `"username`": `"donnelleyaccount`",`n `"password`": `"pa55word`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/rr_donnelley' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my rr donnelley account","username":"donnelleyaccount","password":"pa55word"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/rr_donnelley", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/rr_donnelley',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my rr donnelley account","username":"donnelleyaccount","password":"pa55word"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/rr_donnelley",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/rr_donnelley"
payload = "{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/rr_donnelley")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/rr_donnelley");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/rr_donnelley")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/rr_donnelley"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/rr_donnelley"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my rr donnelley account\",\n \"username\": \"donnelleyaccount\",\n \"password\": \"pa55word\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/rr_donnelley")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a RR Donnelley Account
DELETE /v1/connections/carriers/rr_donnelley/:id
DELETE /v1/connections/carriers/rr_donnelley/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/rr_donnelley/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Seko
Seko Account Information Model
Property | Description |
---|---|
nickname | string, required |
access_key | string, required |
Connect a Seko Account
POST /v1/connections/carriers/seko
POST /v1/connections/carriers/seko HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my seko account",
"access_key": "you_access_key_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/seko \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my seko account",
"access_key": "you_access_key_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my seko account`",`n `"access_key`": `"you_access_key_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/seko' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my seko account","access_key":"you_access_key_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/seko", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/seko',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my seko account","access_key":"you_access_key_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/seko",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/seko"
payload = "{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/seko")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/seko");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/seko")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/seko"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/seko"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my seko account\",\n \"access_key\": \"you_access_key_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/seko")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Seko Account
DELETE /v1/connections/carriers/seko/:id
DELETE /v1/connections/carriers/seko/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/seko/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/seko/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/seko/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/seko/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/seko/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/seko/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/seko/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/seko/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/seko/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/seko/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/seko/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/seko/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Sendle
Sendle Account Information Model
Property | Description |
---|---|
nickname |
string, required |
sendle_id |
string, required |
api_key |
string, required |
Connect a Sendle account
POST /v1/connections/carriers/sendle
POST /v1/connections/carriers/sendle HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "Test Sendle Account",
"sendle_id": "your_username_here",
"api_key": "your_password_here"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/sendle \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "Test Sendle Account",
"sendle_id": "your_username_here",
"api_key": "your_password_here"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"Test Sendle Account`",`n `"sendle_id`": `"your_username_here`",`n `"api_key`": `"your_password_here`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/sendle' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"Test Sendle Account","sendle_id":"your_username_here","api_key":"your_password_here"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/sendle", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/sendle',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"Test Sendle Account","sendle_id":"your_username_here","api_key":"your_password_here"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/sendle",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/sendle"
payload = "{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/sendle")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/sendle");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/sendle")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/sendle"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/sendle"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"Test Sendle Account\",\n \"sendle_id\": \"your_username_here\",\n \"api_key\": \"your_password_here\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/sendle")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Sendle account
DELETE /v1/connections/carriers/sendle/:id
DELETE /v1/connections/carriers/sendle/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/sendle/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/sendle/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/sendle/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/sendle/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/sendle/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/sendle/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/sendle/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/sendle/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/sendle/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/sendle/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/sendle/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/sendle/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Stamps.com
Stamps.com Account Information Model
Property | Description |
---|---|
nickname | string, required |
username | string, required |
password | string, required |
Connect a Stamps.com account
POST /v1/connections/carriers/stamps_com
POST /v1/connections/carriers/stamps_com HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My stamps.com account",
"username": "__YOUR_USERNAME_HERE__",
"password": "__YOUR_PASSWORD_HERE"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/stamps_com \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My stamps.com account",
"username": "__YOUR_USERNAME_HERE__",
"password": "__YOUR_PASSWORD_HERE"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My stamps.com account`",`n `"username`": `"__YOUR_USERNAME_HERE__`",`n `"password`": `"__YOUR_PASSWORD_HERE`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/stamps_com' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My stamps.com account","username":"__YOUR_USERNAME_HERE__","password":"__YOUR_PASSWORD_HERE"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/stamps_com", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/stamps_com',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My stamps.com account","username":"__YOUR_USERNAME_HERE__","password":"__YOUR_PASSWORD_HERE"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/stamps_com",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/stamps_com"
payload = "{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/stamps_com")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/stamps_com");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/stamps_com")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/stamps_com"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/stamps_com"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My stamps.com account\",\n \"username\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/stamps_com")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Stamps.com account
DELETE /v1/connections/carriers/stamps_com/:id
DELETE /v1/connections/carriers/stamps_com/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/stamps_com/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
StarTrack (AU)
StarTrack Account Information Model
Property | Description |
---|---|
nickname | string, required |
account_number | string, required |
user_id | string, required |
password | string, required |
Connect a StarTrack account
POST /v1/connections/carriers/star_track
POST /v1/connections/carriers/star_track HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My Star Track account",
"account_number": "12345",
"user_id": "__YOUR_USERNAME_HERE__",
"password": "__YOUR_PASSWORD_HERE"
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/star_track \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My Star Track account",
"account_number": "12345",
"user_id": "__YOUR_USERNAME_HERE__",
"password": "__YOUR_PASSWORD_HERE"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My Star Track account`",`n `"account_number`": `"12345`",`n `"user_id`": `"__YOUR_USERNAME_HERE__`",`n `"password`": `"__YOUR_PASSWORD_HERE`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/star_track' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My Star Track account","account_number":"12345","user_id":"__YOUR_USERNAME_HERE__","password":"__YOUR_PASSWORD_HERE"});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/star_track", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/star_track',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My Star Track account","account_number":"12345","user_id":"__YOUR_USERNAME_HERE__","password":"__YOUR_PASSWORD_HERE"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/star_track",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/star_track"
payload = "{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/star_track")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/star_track");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/star_track")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/star_track"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/star_track"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My Star Track account\",\n \"account_number\": \"12345\",\n \"user_id\": \"__YOUR_USERNAME_HERE__\",\n \"password\": \"__YOUR_PASSWORD_HERE\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/star_track")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Disconnect a Star Track account
DELETE /v1/connections/carriers/star_track/:id
DELETE /v1/connections/carriers/star_track/se-1234567 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/star_track/se-1234567")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
UPS (Worldwide)
info
UPS Technology Agreement
By connecting a UPS account, you and your users agree to the UPS Technology Agreement.
UPS Account Information Model
Property | Description |
---|---|
nickname | string, required A nickname for your account in ShipEngine. Very useful if you have multiple accounts for the same carrier. |
account_number | string, required |
account_country_code | string, required |
account_postal_code | string, required |
title | string, required |
first_name | string, required |
last_name | string, required |
company | string |
address1 | string, required |
address2 | string |
city | string, required |
state | string, required |
postal_code | string, required |
country_code | string, required |
string, required | |
phone | string, required |
invoice | UPS Invoice Model, only required if this account has received an invoice in the last 90 days |
agree_to_technology_agreement | bool, required |
UPS Invoice Model
Property | Description |
---|---|
control_id | string, required |
invoice_number | string, required |
invoice_amount | decimal`, required |
invoice_date | datetime, required |
Connect a UPS Account
POST /v1/connections/carriers/ups
POST /v1/connections/carriers/ups HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "My UPS account",
"account_number": "123456789",
"account_country_code": "US",
"account_postal_code": "78756",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"address1": "4009 Marathon Blvd.",
"address2": "Suite 300",
"city": "Austin",
"state": "TX",
"postal_code": "78756",
"country_code": "US",
"phone": "111-111-1111",
"email": "[email protected]",
"agree_to_technology_agreement": "true",
"invoice": {
"control_id": "10Z3",
"invoice_number": "0000A123B4567",
"invoice_amount": "100.98",
"invoice_date": "2017-04-01"
}
}
curl -iX POST https://api.shipengine.com/v1/connections/carriers/ups \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "My UPS account",
"account_number": "123456789",
"account_country_code": "US",
"account_postal_code": "78756",
"company": "Example Corp.",
"first_name": "John",
"last_name": "Doe",
"address1": "4009 Marathon Blvd.",
"address2": "Suite 300",
"city": "Austin",
"state": "TX",
"postal_code": "78756",
"country_code": "US",
"phone": "111-111-1111",
"email": "[email protected]",
"agree_to_technology_agreement": "true",
"invoice": {
"control_id": "10Z3",
"invoice_number": "0000A123B4567",
"invoice_amount": "100.98",
"invoice_date": "2017-04-01"
}
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"My UPS account`",`n `"account_number`": `"123456789`",`n `"account_country_code`": `"US`",`n `"account_postal_code`": `"78756`",`n `"company`": `"Example Corp.`",`n `"first_name`": `"John`",`n `"last_name`": `"Doe`",`n `"address1`": `"4009 Marathon Blvd.`",`n `"address2`": `"Suite 300`",`n `"city`": `"Austin`",`n `"state`": `"TX`",`n `"postal_code`": `"78756`",`n `"country_code`": `"US`",`n `"phone`": `"111-111-1111`",`n `"email`": `"[email protected]`",`n `"agree_to_technology_agreement`": `"true`",`n `"invoice`": {`n `"control_id`": `"10Z3`",`n `"invoice_number`": `"0000A123B4567`",`n `"invoice_amount`": `"100.98`",`n `"invoice_date`": `"2017-04-01`"`n }`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ups' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"My UPS account","account_number":"123456789","account_country_code":"US","account_postal_code":"78756","company":"Example Corp.","first_name":"John","last_name":"Doe","address1":"4009 Marathon Blvd.","address2":"Suite 300","city":"Austin","state":"TX","postal_code":"78756","country_code":"US","phone":"111-111-1111","email":"[email protected]","agree_to_technology_agreement":"true","invoice":{"control_id":"10Z3","invoice_number":"0000A123B4567","invoice_amount":"100.98","invoice_date":"2017-04-01"}});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ups", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.shipengine.com/v1/connections/carriers/ups',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"My UPS account","account_number":"123456789","account_country_code":"US","account_postal_code":"78756","company":"Example Corp.","first_name":"John","last_name":"Doe","address1":"4009 Marathon Blvd.","address2":"Suite 300","city":"Austin","state":"TX","postal_code":"78756","country_code":"US","phone":"111-111-1111","email":"[email protected]","agree_to_technology_agreement":"true","invoice":{"control_id":"10Z3","invoice_number":"0000A123B4567","invoice_amount":"100.98","invoice_date":"2017-04-01"}})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ups"
payload = "{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ups")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ups");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ups")
.method("POST", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ups"
method := "POST"
payload := strings.NewReader("{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ups"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"My UPS account\",\n \"account_number\": \"123456789\",\n \"account_country_code\": \"US\",\n \"account_postal_code\": \"78756\",\n \"company\": \"Example Corp.\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"address1\": \"4009 Marathon Blvd.\",\n \"address2\": \"Suite 300\",\n \"city\": \"Austin\",\n \"state\": \"TX\",\n \"postal_code\": \"78756\",\n \"country_code\": \"US\",\n \"phone\": \"111-111-1111\",\n \"email\": \"[email protected]\",\n \"agree_to_technology_agreement\": \"true\",\n \"invoice\": {\n \"control_id\": \"10Z3\",\n \"invoice_number\": \"0000A123B4567\",\n \"invoice_amount\": \"100.98\",\n \"invoice_date\": \"2017-04-01\"\n }\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ups")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"carrier-id": "se-1234567"
}
{
"carrier-id": "se-1234567"
}
Modify UPS Settings
ShipEngine takes advantage of some of UPS's advanced functionality but does not enable it by default.
Pickup Type
Parameter | Description |
---|---|
pickup_type | enumerated string, daily_pickup , occasional_pickup , customer_counter |
Carbon Neutral Shipping Program
Parameter | Description |
---|---|
use_carbon_neutral_shipping_program | bool |
Ground Freight Pricing
Parameter | Description |
---|---|
use_ground_freight_pricing (deprecated) | bool |
Negotiated Rates
Parameter | Description |
---|---|
use_negotiated_rates | bool If your account has been approved for Negotiated Rates, you can use this option to enable this account to use those rates. Once enabled, you cannot disable Negotiated Rates. |
account_postal_code | string, only required for enabling negotiated rates |
invoice | UPS Invoice Model, only required for enabling negotiated rates See Connect UPS for the UPS Invoice Model. |
Consolidation Service
Parameter | Description |
---|---|
use_consolidation_services | bool |
use_order_number_on_mail_innovations_labels | bool |
mail_innovations_endorsement | enumerated string none , return_service_requested , forwarding_service_requested , address_service_requested ,change_service_requested ,leave_if_no_response |
mail_innovations_cost_center | string |
Common Settings
Parameter | Description |
---|---|
nickname | bool Nickname for the account that will appear on carrier calls and in the UI. |
is_primary_account | bool Whether or not the account is set to primary, this currently has no function inside of ShipEngine. |
PUT /v1/connections/carriers/ups/:ups_id/settings
PUT /v1/connections/carriers/ups/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"nickname": "my ups account",
"is_primary_account": "true",
"pickup_type": "daily_pickup",
"use_carbon_neutral_shipping_program": "true",
"use_ground_freight_pricing": "true",
"use_negotiated_rates": "true",
"account_postal_code": "78756",
"invoice": {
"control_id": "1234",
"invoice_number": "12345",
"invoice_amount": "1.99",
"invoice_date": "2019-7-26"
},
"use_consolidation_services": "true",
"use_order_number_on_mail_innovations_labels": "true",
"mail_innovations_endorsement": "change_service_requested",
"mail_innovations_cost_center": "TEST"
}
curl -iX PUT https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
-H 'Content-Type: application/json' \
-d '{
"nickname": "my ups account",
"is_primary_account": "true",
"pickup_type": "daily_pickup",
"use_carbon_neutral_shipping_program": "true",
"use_ground_freight_pricing": "true",
"use_negotiated_rates": "true",
"account_postal_code": "78756",
"invoice": {
"control_id": "1234",
"invoice_number": "12345",
"invoice_amount": "1.99",
"invoice_date": "2019-7-26"
},
"use_consolidation_services": "true",
"use_order_number_on_mail_innovations_labels": "true",
"mail_innovations_endorsement": "change_service_requested",
"mail_innovations_cost_center": "TEST"
}'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$headers.Add("Content-Type", "application/json")
$body = "{`n `"nickname`": `"my ups account`",`n `"is_primary_account`": `"true`",`n `"pickup_type`": `"daily_pickup`",`n `"use_carbon_neutral_shipping_program`": `"true`",`n `"use_ground_freight_pricing`": `"true`",`n `"use_negotiated_rates`": `"true`",`n `"account_postal_code`": `"78756`",`n `"invoice`": {`n `"control_id`": `"1234`",`n `"invoice_number`": `"12345`",`n `"invoice_amount`": `"1.99`",`n `"invoice_date`": `"2019-7-26`"`n },`n `"use_consolidation_services`": `"true`",`n `"use_order_number_on_mail_innovations_labels`": `"true`",`n `"mail_innovations_endorsement`": `"change_service_requested`",`n `"mail_innovations_cost_center`": `"TEST`"`n}"
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings' -Method 'PUT' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({"nickname":"my ups account","is_primary_account":"true","pickup_type":"daily_pickup","use_carbon_neutral_shipping_program":"true","use_ground_freight_pricing":"true","use_negotiated_rates":"true","account_postal_code":"78756","invoice":{"control_id":"1234","invoice_number":"12345","invoice_amount":"1.99","invoice_date":"2019-7-26"},"use_consolidation_services":"true","use_order_number_on_mail_innovations_labels":"true","mail_innovations_endorsement":"change_service_requested","mail_innovations_cost_center":"TEST"});
var requestOptions = {
method: 'PUT',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
},
body: JSON.stringify({"nickname":"my ups account","is_primary_account":"true","pickup_type":"daily_pickup","use_carbon_neutral_shipping_program":"true","use_ground_freight_pricing":"true","use_negotiated_rates":"true","account_postal_code":"78756","invoice":{"control_id":"1234","invoice_number":"12345","invoice_amount":"1.99","invoice_date":"2019-7-26"},"use_consolidation_services":"true","use_order_number_on_mail_innovations_labels":"true","mail_innovations_endorsement":"change_service_requested","mail_innovations_cost_center":"TEST"})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS =>"{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
payload = "{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}"
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
request["Content-Type"] = "application/json"
request.body = "{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
.method("PUT", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
method := "PUT"
payload := strings.NewReader("{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__",
@"Content-Type": @"application/json"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"nickname\": \"my ups account\",\n \"is_primary_account\": \"true\",\n \"pickup_type\": \"daily_pickup\",\n \"use_carbon_neutral_shipping_program\": \"true\",\n \"use_ground_freight_pricing\": \"true\",\n \"use_negotiated_rates\": \"true\",\n \"account_postal_code\": \"78756\",\n \"invoice\": {\n \"control_id\": \"1234\",\n \"invoice_number\": \"12345\",\n \"invoice_amount\": \"1.99\",\n \"invoice_date\": \"2019-7-26\"\n },\n \"use_consolidation_services\": \"true\",\n \"use_order_number_on_mail_innovations_labels\": \"true\",\n \"mail_innovations_endorsement\": \"change_service_requested\",\n \"mail_innovations_cost_center\": \"TEST\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "PUT"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
GET /v1/connections/carriers/ups/:ups_id/settings
GET /v1/connections/carriers/ups/se-123/settings HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX GET https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings' -Method 'GET' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")
.method("GET", null)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/ups/se-123/settings")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
{
"nickname": "UPS-28A1R9",
"is_primary_account": true,
"pickup_type": "daily_pickup",
"use_carbon_neutral_shipping_program": false,
"use_ground_freight_pricing": false,
"use_consolidation_services": false,
"use_order_number_on_mail_innovations_labels": false,
"mail_innovations_endorsement": "none",
"mail_innovations_cost_center": null,
"use_negotiated_rates": false,
"account_postal_code": null,
"invoice": null
}
{
"nickname": "UPS-28A1R9",
"is_primary_account": true,
"pickup_type": "daily_pickup",
"use_carbon_neutral_shipping_program": false,
"use_ground_freight_pricing": false,
"use_consolidation_services": false,
"use_order_number_on_mail_innovations_labels": false,
"mail_innovations_endorsement": "none",
"mail_innovations_cost_center": null,
"use_negotiated_rates": false,
"account_postal_code": null,
"invoice": null
}
Disconnect a UPS Account
DELETE /v1/connections/carriers/ups/:id
DELETE /v1/connections/carriers/UPS/se-1234 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
curl -iX DELETE https://api.shipengine.com/v1/connections/carriers/UPS/se-1234 \
-H 'API-Key: __YOUR_API_KEY_HERE__' \
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Host", "api.shipengine.com")
$headers.Add("API-Key", "__YOUR_API_KEY_HERE__")
$response = Invoke-RestMethod 'https://api.shipengine.com/v1/connections/carriers/UPS/se-1234' -Method 'DELETE' -Headers $headers -Body $body
$response | ConvertTo-Json
var myHeaders = new Headers();
myHeaders.append("Host", "api.shipengine.com");
myHeaders.append("API-Key", "__YOUR_API_KEY_HERE__");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.shipengine.com/v1/connections/carriers/UPS/se-1234", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://api.shipengine.com/v1/connections/carriers/UPS/se-1234',
'headers': {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.shipengine.com/v1/connections/carriers/UPS/se-1234",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"Host: api.shipengine.com",
"API-Key: __YOUR_API_KEY_HERE__"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.shipengine.com/v1/connections/carriers/UPS/se-1234"
payload = {}
headers = {
'Host': 'api.shipengine.com',
'API-Key': '__YOUR_API_KEY_HERE__'
}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
require "uri"
require "net/http"
url = URI("https://api.shipengine.com/v1/connections/carriers/UPS/se-1234")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Host"] = "api.shipengine.com"
request["API-Key"] = "__YOUR_API_KEY_HERE__"
response = https.request(request)
puts response.read_body
var client = new RestClient("https://api.shipengine.com/v1/connections/carriers/UPS/se-1234");
client.Timeout = -1;
var request = new RestRequest(Method.DELETE);
request.AddHeader("Host", "api.shipengine.com");
request.AddHeader("API-Key", "__YOUR_API_KEY_HERE__");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.shipengine.com/v1/connections/carriers/UPS/se-1234")
.method("DELETE", body)
.addHeader("Host", "api.shipengine.com")
.addHeader("API-Key", "__YOUR_API_KEY_HERE__")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.shipengine.com/v1/connections/carriers/UPS/se-1234"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Host", "api.shipengine.com")
req.Header.Add("API-Key", "__YOUR_API_KEY_HERE__")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.shipengine.com/v1/connections/carriers/UPS/se-1234"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Host": @"api.shipengine.com",
@"API-Key": @"__YOUR_API_KEY_HERE__"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.shipengine.com/v1/connections/carriers/UPS/se-1234")!,timeoutInterval: Double.infinity)
request.addValue("api.shipengine.com", forHTTPHeaderField: "Host")
request.addValue("__YOUR_API_KEY_HERE__", forHTTPHeaderField: "API-Key")
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
When UPS has been successfully disconnected, you will receive a HTTP 204, No Content status.