The “Create Shipping Rate” API allows adding a new shipping rate.
POST https://services.leadconnectorhq.com/store/shipping-zone/{shippingZoneId}/shipping-rate
Autorización
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.
Path parameters
shippingZoneId
string
default:"6578278e879ad2646715ba9c"
required
ID of the item that needs to be returned
Body
altId
string
default:"6578278e879ad2646715ba9c"
required
Account Id or Agency Id
Posibles valores: ‘account’
name
string
default:"North zone"
required
Name of the shipping zone
description
string
default:"Ships next day"
Delivery description
currency
string
default:"USD"
required
The currency of the amount of the rate / handling fee
amount
number
default:"99.99"
required
The amount of the shipping rate if it is normal rate (0 means free ). Fixed Handling fee if it is a carrier rate (it will add to the carrier rate).
conditionType
string
default:"price"
required
Type of condition to provide the conditional pricing Posibles valores: ‘none’, ‘price’, ‘weight’
minCondition
number
default:"99.99"
required
Minimum condition for applying this price. set 0 or null if there is no minimum
maxCondition
number
default:"99.99"
required
Maximum condition for applying this price. set 0 or null if there is no maximum
shippingCarrierId
string
default:"655b33a82209e60b6adb87a5"
required
Shipping carrier id
Percentage of rate fee if it is a carrier rate.
An array of items
name
string
default:"Priority Mail Express International"
required
Name of the shipping carrier service
value
string
default:"PriorityMailExpressInternational"
required
Value of the shipping carrier service
Respuestas
201 - Successful response
status
boolean
default:"True"
required
Status of api action
message
string
default:"Successfully created"
Success message
{
"status": true,
"message": "Successfully created"
}
422 - Unprocessable Entity
Ejemplo
curl -X POST 'https://services.leadconnectorhq.com/store/shipping-zone/YOUR_shippingZoneId/shipping-rate' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"altId": "6578278e879ad2646715ba9c",
"altType": "account",
"name": "North zone",
"description": "Ships next day",
"currency": "USD",
"amount": 99.99,
"conditionType": "price",
"minCondition": 99.99,
"maxCondition": 99.99,
"isCarrierRate": true,
"shippingCarrierId": "655b33a82209e60b6adb87a5",
"percentageOfRateFee": 10.99,
"shippingCarrierServices": [
{
"name": "Priority Mail Express International",
"value": "PriorityMailExpressInternational"
}
]
}'
const response = await fetch('https://services.leadconnectorhq.com/store/shipping-zone/YOUR_shippingZoneId/shipping-rate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "North zone", "description": "Ships next day", "currency": "USD", "amount": 99.99, "conditionType": "price", "minCondition": 99.99, "maxCondition": 99.99, "isCarrierRate": true, "shippingCarrierId": "655b33a82209e60b6adb87a5", "percentageOfRateFee": 10.99, "shippingCarrierServices": [{"name": "Priority Mail Express International", "value": "PriorityMailExpressInternational"}]}),
});
const data = await response.json();
import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/store/shipping-zone/YOUR_shippingZoneId/shipping-rate',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "name": "North zone", "description": "Ships next day", "currency": "USD", "amount": 99.99, "conditionType": "price", "minCondition": 99.99, "maxCondition": 99.99, "isCarrierRate": true, "shippingCarrierId": "655b33a82209e60b6adb87a5", "percentageOfRateFee": 10.99, "shippingCarrierServices": [{"name": "Priority Mail Express International", "value": "PriorityMailExpressInternational"}]},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/store/shipping-zone/YOUR_shippingZoneId/shipping-rate');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'name': 'North zone', 'description': 'Ships next day', 'currency': 'USD', 'amount': 99.99, 'conditionType': 'price', 'minCondition': 99.99, 'maxCondition': 99.99, 'isCarrierRate': true, 'shippingCarrierId': '655b33a82209e60b6adb87a5', 'percentageOfRateFee': 10.99, 'shippingCarrierServices': [{'name': 'Priority Mail Express International', 'value': 'PriorityMailExpressInternational'}]}),
]);
$data = json_decode(curl_exec($ch), true);