Skip to main content

Create Shipping Method

Creates a new shipping method

HTTP Request

POST/api/shipping/methods

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with ShippingMethodPermission or Admin
  • Permission Code: 2601
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Request Body

FieldTypeRequiredDescription
activeBooleanNoWhether the shipping method is active (default=True)
orderIntegerNoThe display row-order of the shipping method
nameStringYesName of the shipping method(unique)
imageIntegerNoID of the image associated with the shipping method
descriptionStringNoDescription of the shipping method
formulaStringYesFormula for calculating shipping costs

Example Requests

1import requests
2
3response = requests.post('http://www.example.com/api/shipping/methods', json={
4  'active': True,
5  'order': 1,
6  'name': 'Standard Shipping',
7  'image': 123,
8  'description': 'Delivery within 5-7 business days.',
9  'formula': 'base_cost + (weight * rate_per_kg)'
10}, headers={
11  'Authorization': 'Token <your_api_key>'
12})
13print(response.json())

Response Fields

FieldTypeDescription
idintegerUnique ID of the shipping method
activebooleanWhether the shipping method is active
orderintegerThe display row order of the shipping method (nullable)
namestringName of the shipping method (unique)
image_dataobjectImage data associated with the shipping method(nullable)
descriptionstringDescription of the shipping method (nullable)
formulastringFormula for calculating shipping costs
created_atstring (ISO 8601)Timestamp when the shipping method was created
updated_atstring (ISO 8601)Timestamp when the shipping method was last updated

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)
thumbnailsList of thumbnail objectsImgae thumbnails

Thumbnail Data Structure

FieldTypeDescription
idIntegerUnique ID of the thumbnail (unique)
fStringURL to access the thumbnail file
sizeIntegerFile size in bytes (nullable)

Example Response

{
"id": 3,
"active": true,
"order": 1,
"name": "Chapar",
"image_data": {
"id": 4,
"type": "image",
"name": "rams",
"size": 118805,
"human_readable_size": "116.02 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/29/RAMFeatured.jpg",
"width": 1280,
"height": 720,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"description": "magnam",
"formula": "1000",
"created_at": "2025-12-20T17:24:23.808373Z",
"updated_at": "2025-12-20T17:24:23.808379Z"
}

Notes

  • The formula field is used to calculate shipping costs based on various parameters like weight, distance, etc.
  • Shipping methods can be ordered using the order field to control display priority