Skip to main content

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

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the shipping method to update

Request Body

FieldTypeRequiredDescription
activeBooleanNoWhether the shipping method is active
orderIntegerNoDisplay order priority
nameStringNoName of the shipping method
imageStringNoURL to the shipping method image
descriptionStringNoDetailed description of the shipping method
formulaStringNoFormula for calculating shipping cost

Example Requests

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())

Status Codes

CodeDescription
200Shipping method updated successfully
400Bad request — invalid input
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Not found — shipping method does not exist
500Internal server error

Response Fields

FieldTypeDescription
idintegerUnique ID of the shipping method
activebooleanWhether the shipping method is active
orderintegerThe order in which the shipping method appears
namestringName of the shipping method
image_dataobjectImage data associated with the shipping method (id, type, name, size, human_readable_size, f, width, height, mode)
descriptionstringDescription of the shipping method
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 Object Fields:

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (read-only, auto-detected)
nameStringOriginal filename
sizeIntegerFile size in bytes (read-only)
human_readable_sizeStringHuman-readable file size (e.g., "2.5 MB")
fStringFile URL/path
widthIntegerImage width in pixels (images only, read-only)
heightIntegerImage height in pixels (images only, read-only)
modeStringImage color mode (images only, read-only)