Shipping
Update shipping zones
Adds or updates zones by name — a zone you don't send stays as it is (nothing is deleted). Handy for shipping companies and suppliers that set the prices.
PATCH
https://elmatajer.com/api/v1/vendor/shipping/areasPermission:
shipping.writeRequest body
| Name | Type | Required | Description |
|---|---|---|---|
areas[].name | string | Yes | Zone name (matched exactly). |
areas[].price | number | Yes | Delivery price. |
areas[].active | bool | No | Turn the zone on or off. |
cities | string | No | Instead of areas: "Cairo:35,Alexandria:50" (Easy Orders format).
|
Request
curl -X PATCH "https://elmatajer.com/api/v1/vendor/shipping/areas" \
-H "Api-Key: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"areas":[{"name":"Cairo","price":35},{"name":"Alexandria","price":50,"active":true}]}'
const res = await fetch("https://elmatajer.com/api/v1/vendor/shipping/areas", {
method: "PATCH",
headers: {
"Api-Key": process.env.ELMATAJER_API_KEY,
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"areas": [
{
"name": "Cairo",
"price": 35
},
{
"name": "Alexandria",
"price": 50,
"active": true
}
]
})
});
const data = await res.json();
$ch = curl_init("https://elmatajer.com/api/v1/vendor/shipping/areas");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Api-Key: " . getenv('ELMATAJER_API_KEY'), "Accept: application/json", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'areas' => [
[
'name' => 'Cairo',
'price' => 35
],
[
'name' => 'Alexandria',
'price' => 50,
'active' => true
]
]
]),
]);
$data = json_decode(curl_exec($ch), true);
Response 200
{
"status": "ok",
"data": {
"created": 1,
"updated": 1,
"areas": [
{
"id": 20,
"name": "Cairo",
"price": 35
},
{
"id": 22,
"name": "Alexandria",
"price": 50
}
]
}
}