Updates the custom order field values for a specific order. Values are grouped by the custom field module that owns them, usually customfields.
Before you begin#
- The API token needs
OrderCustomFields_Update, either assigned directly under Functions or through a group. See Create an API token. - Requests must be signed if the token requires it. See Make a signed request with HMAC.
- You need the order’s
Order_IDand the codes of the custom fields.OrderCustomFieldList_Loadlists the fields and their modules.
Example requests#
Update a custom field#
Sets the rep field in the customfields module to Hello World on order 200107.
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "OrderCustomFields_Update",
"Order_ID": 200107,
"CustomField_Values": {
"customfields": {
"rep": "Hello World"
}
}
}
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
Order_ID |
Number | Order number to update | |
CustomField_Values |
Object | Object containing individual custom field data. Each child object will be the module code (e.g., customfields, productimagecustomfields) |
customfields: Module Code - Module Code of the custom field module to update. Typically will be “customfields” but other modules support the custom fields feature.field_code1: String - This is the custom field code to update. Its value is the custom field value to update.
Example response#
{
"success": 1
}
Response parameters#
| Name | Description |
|---|---|
success |
Boolean value for if the request was successful |
processed |
Boolean value if function was processed |
Error responses#
| Error Code | Error Message | Error Description |
|---|---|---|
| MER-JSN-ORD-00025 | Order not found | Order number not found. |
| MER-JSN-00018 | Invalid value for field ‘CustomField_Values:customfields:reps’ | Failed to load custom field ‘reps’. |
Related functions#
| Function | Use it to |
|---|---|
OrderCustomFieldList_Load |
List the custom order fields and their modules |
OrderList_Load_Query |
Read an order’s custom field values with the CustomField_Values on-demand column |
Order_Update_Customer_Information |
Update the order’s bill to and ship to information |
Try in Postman#
In the Miva: JSON API: Authenticated collection, open Orders > OrderCustomFields_Update. See Set Up Postman.