API: Sale Orders Creation
Table of Contents
The Enapps ERP API Sales Order Creation endpoint provides the necessary functionality to create Sale Orders on the Enapps ERP. This is a single API call, which creates on the ERP the order, lines, the necessary delivery address from the information supplied.
Base URL |
https://<server>:<port>/api/v1 |
Endpoint |
/orders |
Method | POST |
Sale Order payload structure | |||
Name | Type | Required | Description |
partner_order_id | integer | Yes |
Ordering Contact ID obtained from the Contacts API. This ID is used to determine the partner's price list and invoice contact. |
products |
JSON array of elements: product_id parameters qty |
Yes |
product_id (integer): The unique ID of the product. parameters (array): an array representing each parameter associated with the product, where each object contains the parameter name as the key and the specific option type as the value. Parameters example: "parameters": [ Please note: the parameter names are case-sensitive.
qty(integer): The quantity of the product in the order
Products JSON array example:{ "product_id" : 19560, } Note: The `price_unit` field is not mandatory, as it is calculated by the ERP system based on the customer pricelist and rules. If provided, this price should strictly correspond to the current price of the product in the ERP system for the specific partner's pricelist calculation formulas. To obtain the actual product unit price for the specific partner, use the `/products/get_detail` API call. Example: /products/get_detail?parameters={"FINISHING":"DBZW"}&product_id=19560&qty=40&partner_id=61239 Note: `partner_id` is the ID of the partner obtained via the Contacts API call for this specific contact ID. |
shop_id | integer | Yes |
ID representing the shop from which the order is placed - please obtain it from your ERP system administrator. Default setting is 1 |
client_order_ref | string | Yes |
Customer PO Number/unique e-order reference. This field if not mandatory. |
shipping_details | array | No |
An array containing Delivery contact and address details. This data will populate the "Delivery Address" field of the Sale Order in the ERP system. All fields are optional, and if empty data is provided, the "Delivery Address" field will not be populated for the Sale Order. Example: Note: if the provided delivery address does not exist in the ERP system for the specific Partner ID, it will be created and set in the ‘Delivery Address’ field of the newly created Sale Order. |
Shipping details array structure | |||
Name | Type | Required | Description |
is_dropship | bool |
No |
If set to 1, the provided delivery address type in the ERP system will be set to "Dropship"; otherwise, the type will be set to "Delivery" |
dropship_company | string |
No |
The name of the dropship company |
dropship_name | string |
No |
The name of the dropship delivery |
delivery_contact_phone | string |
No |
Delivery contact phone number |
delivery_contact_email | string |
No |
Delivery contact email address |
state | string |
No |
County/state name |
first_name | string |
No |
Delivery person's first name |
last_name | string |
No |
Delivery person's last name |
company_name | string |
No |
Company name |
country | string |
No |
2-letter country code, e.g., GB |
street_address_1 | string |
No |
Street address |
street_address_2 | string |
No |
Additional street address |
town_city | string |
No |
Town/city name |
postcode | string |
No |
Postcode with spacing, e.g., 12A BZ |
Request example
POST /api/v1/orders/ HTTP/1.1 { |
Successful Response Example
{ "id": 644053, "name": "SO094322", "client_order_ref": "TEST_REF", "delivery_address_id": [ 55664, "1 Grove Road, London, 12A BZ, GB, (Delivery)" ], "state": "draft", "amount_total": 1301.43, "amount_tax": 216.41, "amount_untaxed": 1084.02, "date_order": "2024-02-29", "pricelist_id": [ 1, "UK Trade Pricelist (GBP)" ], "partner_id": [ 61239, "Company #1 (COMP_1)" ], "shop_id": [ 1, "MainShop" ], "partner_shipping_id": false, "partner_order_id": [ 214005, "John Smith, Studio 3, The Street, London, CE2 1HH | Company #1 (COMP_1)" ], "create_date": "2024-02-29 07:32:40", "order_line": [ 1197191, 1197190 ] } |