Configure a service provider
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"service_provider_id": "<string>",
"api_credentials": {},
"warehouse_id": [
"<string>"
],
"shipping_zone_id": [
"<string>"
]
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers"
payload = {
"service_provider_id": "<string>",
"api_credentials": {},
"warehouse_id": ["<string>"],
"shipping_zone_id": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_provider_id: '<string>',
api_credentials: {},
warehouse_id: ['<string>'],
shipping_zone_id: ['<string>']
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_provider_id' => '<string>',
'api_credentials' => [
],
'warehouse_id' => [
'<string>'
],
'shipping_zone_id' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers"
payload := strings.NewReader("{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"service_provider": {
"id": "<string>",
"name": "<string>",
"service_type": "shipping",
"description": "<string>",
"short_description": "<string>",
"type": "auto",
"fulfillment_type": "delivery",
"logo_dark": "<string>",
"logo_light": "<string>",
"website_url": "<string>",
"api_doc_url": "<string>",
"required_credentials_params": [
{
"input_field_name": "<string>",
"input_field_label": "<string>",
"input_field_type": "text"
}
],
"is_connected": false,
"is_forward_shipping": false,
"is_return_shipping": false,
"is_connection_expired": true,
"supports_test_connection": true,
"api_credentials": {},
"status": "active",
"features": [
{
"name": "<string>",
"description": "<string>",
"is_supported": true,
"features": [
{
"name": "<string>",
"description": "<string>",
"is_supported": true
}
]
}
],
"warehouses": [
{
"id": "<string>",
"name": "<string>"
}
],
"shipping_zone": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}
}Store
Configure a service provider
Configure a service provider.
POST
/
store
/
service-providers
Configure a service provider
curl --request POST \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"service_provider_id": "<string>",
"api_credentials": {},
"warehouse_id": [
"<string>"
],
"shipping_zone_id": [
"<string>"
]
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers"
payload = {
"service_provider_id": "<string>",
"api_credentials": {},
"warehouse_id": ["<string>"],
"shipping_zone_id": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_provider_id: '<string>',
api_credentials: {},
warehouse_id: ['<string>'],
shipping_zone_id: ['<string>']
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'service_provider_id' => '<string>',
'api_credentials' => [
],
'warehouse_id' => [
'<string>'
],
'shipping_zone_id' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers"
payload := strings.NewReader("{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/store/service-providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_provider_id\": \"<string>\",\n \"api_credentials\": {},\n \"warehouse_id\": [\n \"<string>\"\n ],\n \"shipping_zone_id\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"service_provider": {
"id": "<string>",
"name": "<string>",
"service_type": "shipping",
"description": "<string>",
"short_description": "<string>",
"type": "auto",
"fulfillment_type": "delivery",
"logo_dark": "<string>",
"logo_light": "<string>",
"website_url": "<string>",
"api_doc_url": "<string>",
"required_credentials_params": [
{
"input_field_name": "<string>",
"input_field_label": "<string>",
"input_field_type": "text"
}
],
"is_connected": false,
"is_forward_shipping": false,
"is_return_shipping": false,
"is_connection_expired": true,
"supports_test_connection": true,
"api_credentials": {},
"status": "active",
"features": [
{
"name": "<string>",
"description": "<string>",
"is_supported": true,
"features": [
{
"name": "<string>",
"description": "<string>",
"is_supported": true
}
]
}
],
"warehouses": [
{
"id": "<string>",
"name": "<string>"
}
],
"shipping_zone": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
- CreateShippingServiceProvider
- CreateOtherServiceProvider
Was this page helpful?
⌘I