Update Shipping Method
Update an existing shipping method.
HTTP Request
PATCH/api/shipping/methods/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Unique ID of the shipping method to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| active | Boolean | No | Whether the shipping method is active |
| order | Integer | No | Display order priority |
| name | String | No | Name of the shipping method |
| image | String | No | URL to the shipping method image |
| description | String | No | Detailed description of the shipping method |
| formula | String | No | Formula for calculating shipping cost |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Update shipping method name and status
4response = requests.patch('http://www.example.com/api/shipping/methods/1',
5 json={
6 'name': 'Express Shipping',
7 'active': True,
8 'order': 1
9 },
10 headers={'Authorization': 'Token <your_api_key>'}
11)
12print(response.json())
13
14# Update formula and description
15response = requests.patch('http://www.example.com/api/shipping/methods/1',
16 json={
17 'formula': 'weight * 2.5 + 5',
18 'description': 'Fast delivery within 24 hours'
19 },
20 headers={'Authorization': 'Token <your_api_key>'}
21)
22print(response.json())1# Update shipping method name and status
2curl -X PATCH "http://www.example.com/api/shipping/methods/1" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
3 "name": "Express Shipping",
4 "active": true,
5 "order": 1
6}'
7
8# Update formula and description
9curl -X PATCH "http://www.example.com/api/shipping/methods/1" -H "Authorization: Token <your_api_key>" -H "Content-Type: application/json" -d '{
10 "formula": "weight * 2.5 + 5",
11 "description": "Fast delivery within 24 hours"
12}'Status Codes
| Code | Description |
|---|---|
| 200 | Shipping method updated successfully |
| 400 | Bad request — invalid input |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Not found — shipping method does not exist |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique ID of the shipping method |
| active | boolean | Whether the shipping method is active |
| order | integer | The order in which the shipping method appears |
| name | string | Name of the shipping method |
| image_data | object | Image data associated with the shipping method (id, type, name, size, human_readable_size, f, width, height, mode) |
| description | string | Description of the shipping method |
| formula | string | Formula for calculating shipping costs |
| created_at | string (ISO 8601) | Timestamp when the shipping method was created |
| updated_at | string (ISO 8601) | Timestamp when the shipping method was last updated |
Image Data Object Fields:
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (read-only, auto-detected) |
| name | String | Original filename |
| size | Integer | File size in bytes (read-only) |
| human_readable_size | String | Human-readable file size (e.g., "2.5 MB") |
| f | String | File URL/path |
| width | Integer | Image width in pixels (images only, read-only) |
| height | Integer | Image height in pixels (images only, read-only) |
| mode | String | Image color mode (images only, read-only) |