createPackage
The method allows you to create a shipment in the system of the selected courier.
Input parameters
Output data:
A sample request in PHP:
order_id | int | Order identifier |
courier_code | varchar(20) | Courier code |
account_id | int | (optional) Courier API account id for the courier accounts retrieved from the request getCourierAccounts If blank, the first account will be used. |
fields | array | List of form fields retrieved from the request getCourierFields For checkbox with multiple selection, the information should be sent in separate arrays e.g. [ { "id":"services", "value":"sms" }, { "id":"services", "value":"email" }, ] |
| - id | varchar(50) | The field ID |
| - value | varchar | Option ID (required for checkbox, select field types) or value (required for text, date field types) Date - format unix time |
packages | array | Array of shipments list, weight of at least one shipment required. The array includes fields received in response to the request getCourierFields. The response returns also information whether the courier supports multiple shipments. As a key use the field 'id' retrieved from the packages_fields parameter in response of the getCourierFields method. As a value of field provide a value compatible with the field type from the getCourierFields response. Height, length, width should be sent in centimeters. Weight should be sent in kilograms. E.g. [ "weight":"1", "height":"25", ] |
Output data
The method returns the data in JSON format.
status | varchar(30) | SUCCESS - request executed correctly ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code |
package_id | int | Shipment ID |
package_number | varchar(40) | Shipping number (consignment number) |
courier_inner_number | varchar(40) | Courier internal number |
Sample
Input data:Output data:
A sample request in PHP: