Contact Us

If you still have questions or prefer to get help directly please submit a request here.
We’ll get back to you as soon as possible.

  • Contact Us
  • Internal Login
Global English
US English (US)
EN Global English
  • Home
  • API
  • API: Sale Orders Creation
  • Support System (intserv)

    • System UI

      • Accounting

        • CRM

          • Sales

            • Purchasing

              • Product Management

                • Warehouse

                  • Manufacturing

                    • Project

                      • HR

                        • Settings (super-user specific)

                          • Ecommerce

                            • One Drive

                              • API

                                API: Sale Orders Creation

                                Table of Contents

                                Products JSON array example: Request example Successful Response Example
                                Written by: Antons Smolientsev, Updated on February 29th, 2024

                                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": 

                                [     
                                 {"Colour": "Red"},     
                                 {"Frame": "White"},     
                                 {"Outer Colour": "Olive"}     
                                ]

                                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,    
                                "parameters" : {"Outer Colour":"White", "Colour":"Blue"},    
                                "qty": 35, 
                                "price_unit":285.08

                                }

                                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:    
                                    {    
                                        “is_dropship”: 0, 
                                        "dropship_company": "", 
                                        "dropship_name": "",   
                                        "delivery_contact_phone": "+44-14-56-234",    
                                        "delivery_contact_email":  "[email protected]",    
                                        "state": "County Cork",    
                                        "first_name": "John",    
                                        "last_name": "Smith",    
                                        "company_name": "My Company inc.",    
                                        "country": "GB",    
                                        "street_address_1": "1 Grove Road",    
                                        "street_address_2": "",    
                                        "town_city": "London",    
                                        "postcode": "WC3 4CA"    
                                    }

                                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 
                                Host: my_company.erp.zone:4095 
                                Content-Type: application/json 
                                Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MDkyNzY1NDQsInQiOiJhY2Nlc3MiLCJsIjoid29vY29tbWVyY2VhcGkiLCJkYiI6InByb2R1Y3Rpb25fZGV2In0.4G_ZhXznSOB0SQETbCqW4GUsVrHPF-VmzA

                                { 
                                    "partner_order_id":214005, 
                                    "products": [ 
                                        { 
                                            "product_id" : 19560, 
                                           "parameters" : {"COLOUR":"WHITE", "FRAME":"BLACK"}, 
                                            "qty": 40 
                                        } 
                                    ], 
                                   "shop_id":1, 
                                      "client_order_ref":"TEST_REF", 
                                    "shipping_details": 
                                    { 
                                        "is_dropship": 0, 
                                        "delivery_contact_phone": "+44 123 456 789", 
                                        "delivery_contact_email": "[email protected]", 
                                        "state": "Kent", 
                                        "first_name": "John", 
                                        "last_name": "Smith", 
                                        "company_name": "MyCompany Inc.", 
                                        "country": "GB", 
                                        "street_address_1": "1 Grove Road", 
                                        "street_address_2": "", 
                                        "town_city": "Orpington", 
                                        "postcode": "BR6 1BZ" 
                                    } 
                                }

                                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 
                                   ] 
                                }

                                Was this article helpful?

                                Yes
                                No
                                Give feedback about this article

                                Related Articles

                                • API: Contacts
                                • API: Deliveries
                                • API: Partners
                                Expand