Order API V3

Permissions

To use the Order V3 API a user is needed with a API access key and permission:

Can access Api V3 Demand OrderController 

Headers

CG-Access-key : the Clougistic user access key

CG-Entity-ID : the Clougistic entity

Content-Type : application/json

Create Order

Method: POST

URL:  /api/v3/demand/order

Sample Request

{

"order": {

"total_amount": 12.34,

"status" : "1",

"type": 0,

"options": {

"packing":{"ogc":true},

"force_mbom_kitting":true,

"carrier": {"name": "flatrate_flatrate", "type": "0000"}

},

"cod_amount": "0",

"source_id": "erp",

"reference": "MAG200",

"customer_id": "1",

"currency": "EUR",

"shipping_method": "free_shipping",

"flag_partial": "",

"created_at": "2020-11-01 01:01:01",

"delivery_at": "",

"billing_company": "Shoe Shop NY",

"billing_firstname": "David",

"billing_lastname": "Copperfield",

"billing_street_full": "Wallstreet 450",

"billing_postcode": "74983",

"billing_city": "New York",

"billing_region": "NY",

"billing_country": "US",

"billing_phone": "",

"billing_email": "d.copperfield@gmail.com",

"shipping_company": "Shoe Shop NY",

"shipping_firstname": "Arnold",

"shipping_lastname": "Schwarzenegger",

"shipping_street_full": "Wallstreet 450",

"shipping_postcode": "74983",

"shipping_city": "New York",

"shipping_region": "NY",

"shipping_country": "US",

"shipping_phone": "",

"shipping_email": "a.schwarzenenegger@gmail.com"},

"items": [

    [{ "sku": "ikea-chair"

        "allocation_method": "3",

        "description": "Ikea Chair"

        "reference": "21",

        "unit_price": "7.18"

        "qty": 3       

}],

    [{ "sku": "ikea-table"

        "description": "Ikea Table"

        "reference": "22",

        "unit_price": "7.18"

        "qty": 12        

}]

]

}


Response 200 OK

{

    "id": 48,

    "reference": "MAG200",

    "entity_id": 1,

    "type": 0,

    "priority": 0,

    "related_id": null,

    "source_id": "erp",

    "customer_id": "1",

    "flag_partial": 0,

    "status": 1,

    "cod_amount": "0.00",

    "total_amount": "12.3400",

    "currency": "EUR",

    "billing_company": "Shoe Shop NY",

    "billing_firstname": "David",

    "billing_lastname": "Copperfield",

    "billing_street_full": "Wallstreet 450",

    "billing_street": null,

    "billing_housenumber": null,

    "billing_housenumber_ext": null,

    "billing_postcode": "74983",

    "billing_city": "New York",

    "billing_region": "NY",

    "billing_country": "US",

    "billing_phone": "",

    "billing_email": "d.copperfield@gmail.com",

    "shipping_company": "Shoe Shop NY",

    "shipping_firstname": "Arnold",

    "shipping_lastname": "Schwarzenegger",

    "shipping_street_full": "Wallstreet 450",

    "shipping_street": null,

    "shipping_housenumber": null,

    "shipping_housenumber_ext": null,

    "shipping_postcode": "74983",

    "shipping_city": "New York",

    "shipping_region": "NY",

    "shipping_country": "US",

    "shipping_phone": "",

    "shipping_email": "a.schwarzenenegger@gmail.com",

    "shipping_method": "free_shipping",

    "options": {

        "packing": {

            "ogc": true

        },

        "carrier": {

            "name": "flatrate_flatrate",

            "type": "0000"

        }

    },

    "supplier_purchase_id": null,

    "delivery_at": null,

    "created_at": "2020-11-01 00:01:01",

    "updated_at": "2022-10-26 08:09:13",

    "status_text": "Processing",

    "type_text": "Sale",

    "flag_partial_text": "All",

    "changeable": [

        "status",

        "flag_partial",

        "related_id",

        "priority",

        "options",

        "billing_company",

        "billing_firstname",

        "billing_lastname",

        "billing_street_full",

        "billing_street",

        "billing_housenumber",

        "billing_housenumber_ext",

        "billing_postcode",

        "billing_city",

        "billing_region",

        "billing_country",

        "billing_phone",

        "billing_email",

        "shipping_company",

        "shipping_firstname",

        "shipping_lastname",

        "shipping_street_full",

        "shipping_street",

        "shipping_housenumber",

        "shipping_housenumber_ext",

        "shipping_postcode",

        "shipping_city",

        "shipping_region",

        "shipping_country",

        "shipping_phone",

        "shipping_email",

        "shipping_method"

    ],

    "possible_statuses": {

        "2": {

            "status": 9,

            "statusText": "Cancelled",

            "statusVerb": "Cancel"

        }

    },

    "can_rma": false,

    "is_closed": false,

    "aggregate": {

        "id": 48,

        "entity_id": 1,

        "type": 0,

        "source_id": "erp",

        "reference": "MAG200",

        "cod_amount": "0.00",

        "total_amount": "12.34",

        "currency": "EUR",

        "flag_partial": 0,

        "status": 1,

        "contact": "Shoe Shop NY",

        "item_qty": 18,

        "item_qty_to_kit": 0,

        "item_amount": "100.52",

        "item_qty_shipped": 0,

        "item_qty_allocated": 18,

        "item_amount_allocated": "86.16",

        "item_prc_allocated": 100,

        "item_prc_process": 0,

        "item_prc_shipped": 0,

        "has_kits": true,

        "created_at": "2020-11-01 00:01:01",

        "delivery_at": null,

        "priority": 0,

        "type_text": "Sale",

        "status_text": "Processing",

        "flag_partial_text": "All"

    },

    "items": [

        {

            "id": 204,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-chair",

            "reference": "21",

            "parent_id": null,

            "allocation_method": 3,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Chair",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "qty_reserved_initial": 0

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 205,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-table",

            "reference": "22",

            "parent_id": null,

            "allocation_method": 1,

            "qty": 12,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Table",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": null,

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 206,

            "order_id": 48,

            "entity_id": 1,

            "sku": "IK-ASSEMBLE",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Product assembly guide - Ikea Chair",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 207,

            "order_id": 48,

            "entity_id": 1,

            "sku": "CHAIR-ARM",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 4,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Chair Arms",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        }

    ]

}


Read Order

Method: GET

URL:  /api/v3/demand/order-by-reference/REFERENCE?source_id=SOURCE-ID 

URL:  /api/v3/demand/order/ID

ID is the unique Ordernumber created by Clougistic.

Sample Request

 /api/v3/demand/order-by-reference/MAG200?source_id=erp

or

/api/v3/demand/order/48


Response 200 OK

{

    "id": 48,

    "reference": "MAG200",

    "entity_id": 1,

    "type": 0,

    "priority": 0,

    "related_id": null,

    "source_id": "erp",

    "customer_id": "1",

    "flag_partial": 0,

    "status": 1,

    "cod_amount": "0.00",

    "total_amount": "12.3400",

    "currency": "EUR",

    "billing_company": "Shoe Shop NY",

    "billing_firstname": "David",

    "billing_lastname": "Copperfield",

    "billing_street_full": "Wallstreet 450",

    "billing_street": null,

    "billing_housenumber": null,

    "billing_housenumber_ext": null,

    "billing_postcode": "74983",

    "billing_city": "New York",

    "billing_region": "NY",

    "billing_country": "US",

    "billing_phone": "",

    "billing_email": "d.copperfield@gmail.com",

    "shipping_company": "Shoe Shop NY",

    "shipping_firstname": "Arnold",

    "shipping_lastname": "Schwarzenegger",

    "shipping_street_full": "Wallstreet 450",

    "shipping_street": null,

    "shipping_housenumber": null,

    "shipping_housenumber_ext": null,

    "shipping_postcode": "74983",

    "shipping_city": "New York",

    "shipping_region": "NY",

    "shipping_country": "US",

    "shipping_phone": "",

    "shipping_email": "a.schwarzenenegger@gmail.com",

    "shipping_method": "free_shipping",

    "options": {

        "packing": {

            "ogc": true

        },

        "carrier": {

            "name": "flatrate_flatrate",

            "type": "0000"

        }

    },

    "supplier_purchase_id": null,

    "delivery_at": null,

    "created_at": "2020-11-01 00:01:01",

    "updated_at": "2022-10-26 08:09:13",

    "status_text": "Processing",

    "type_text": "Sale",

    "flag_partial_text": "All",

    "changeable": [

        "status",

        "flag_partial",

        "related_id",

        "priority",

        "options",

        "billing_company",

        "billing_firstname",

        "billing_lastname",

        "billing_street_full",

        "billing_street",

        "billing_housenumber",

        "billing_housenumber_ext",

        "billing_postcode",

        "billing_city",

        "billing_region",

        "billing_country",

        "billing_phone",

        "billing_email",

        "shipping_company",

        "shipping_firstname",

        "shipping_lastname",

        "shipping_street_full",

        "shipping_street",

        "shipping_housenumber",

        "shipping_housenumber_ext",

        "shipping_postcode",

        "shipping_city",

        "shipping_region",

        "shipping_country",

        "shipping_phone",

        "shipping_email",

        "shipping_method"

    ],

    "possible_statuses": {

        "2": {

            "status": 9,

            "statusText": "Cancelled",

            "statusVerb": "Cancel"

        }

    },

    "can_rma": false,

    "is_closed": false,

    "aggregate": {

        "id": 48,

        "entity_id": 1,

        "type": 0,

        "source_id": "erp",

        "reference": "MAG200",

        "cod_amount": "0.00",

        "total_amount": "12.34",

        "currency": "EUR",

        "flag_partial": 0,

        "status": 1,

        "contact": "Shoe Shop NY",

        "item_qty": 18,

        "item_qty_to_kit": 0,

        "item_amount": "100.52",

        "item_qty_shipped": 0,

        "item_qty_allocated": 18,

        "item_amount_allocated": "86.16",

        "item_prc_allocated": 100,

        "item_prc_process": 0,

        "item_prc_shipped": 0,

        "has_kits": true,

        "created_at": "2020-11-01 00:01:01",

        "delivery_at": null,

        "priority": 0,

        "type_text": "Sale",

        "status_text": "Processing",

        "flag_partial_text": "All"

    },

    "items": [

        {

            "id": 204,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-chair",

            "reference": "21",

            "parent_id": null,

            "allocation_method": 3,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Chair",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "qty_reserved_initial": 0

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 205,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-table",

            "reference": "22",

            "parent_id": null,

            "allocation_method": 1,

            "qty": 12,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Table",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": null,

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 206,

            "order_id": 48,

            "entity_id": 1,

            "sku": "IK-ASSEMBLE",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Product assembly guide - Ikea Chair",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 207,

            "order_id": 48,

            "entity_id": 1,

            "sku": "CHAIR-ARM",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 4,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Chair Arms",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        }

    ]

}


Update Order

Method: PUT

URL:  /api/v3/demand/order-by-reference/REFERENCE

URL:  /api/v3/demand/order/ID

Update policies

Order State: New

Order State: PROCESSING

An update request will first handle the order items and secondly the order itself. This means changing order item attributes and the order state change from new to processing in one request will make sure the changes to order items will be done correctly.

In case the request tries to change any processing order item, Clougistic will throw an error (500).

When changing item allocation type 3, any reservations will be removed and replaced with the new request qty.

Cancel an Order

URL:  /api/v3/demand/order-by-reference/REFERENCE/cancel

*In case a new order must use the same reference as the cancelled order, the cancelled order referenced should be updated first to a different reference. 

Sample Request

{

"order": {

"total_amount": 12.34,

"status" : "1",

"type": 0,

"options": {

"packing":{"ogc":true},

"force_mbom_kitting":true, 

"carrier": {"name": "flatrate_flatrate", "type": "0000"}

},

"cod_amount": "0",

"source_id": "erp",

"reference": "MAG200",

"customer_id": "1",

"currency": "EUR",

"shipping_method": "free_shipping",

"flag_partial": "",

"created_at": "2020-11-01 01:01:01",

"delivery_at": "",

"billing_company": "Shoe Shop NY",

"billing_firstname": "David",

"billing_lastname": "Copperfield",

"billing_street_full": "Wallstreet 450",

"billing_postcode": "74983",

"billing_city": "New York",

"billing_region": "NY",

"billing_country": "US",

"billing_phone": "",

"billing_email": "d.copperfield@gmail.com",

"shipping_company": "Shoe Shop NY",

"shipping_firstname": "Arnold",

"shipping_lastname": "Schwarzenegger",

"shipping_street_full": "Wallstreet 450",

"shipping_postcode": "74983",

"shipping_city": "New York",

"shipping_region": "NY",

"shipping_country": "US",

"shipping_phone": "",

"shipping_email": "a.schwarzenenegger@gmail.com"},

"items": [

    [{ "sku": "ikea-chair"

        "allocation_method": "3",

        "description": "Ikea Chair"

        "reference": "21",

        "unit_price": "7.18"

        "qty": 3       

}],

    [{ "sku": "ikea-table"

        "description": "Ikea Table"

        "reference": "22",

        "unit_price": "7.18"

        "qty": 12        

}]

]

}


Response 200 OK

{

    "id": 48,

    "reference": "MAG200",

    "entity_id": 1,

    "type": 0,

    "priority": 0,

    "related_id": null,

    "source_id": "erp",

    "customer_id": "1",

    "flag_partial": 0,

    "status": 1,

    "cod_amount": "0.00",

    "total_amount": "12.3400",

    "currency": "EUR",

    "billing_company": "Shoe Shop NY",

    "billing_firstname": "David",

    "billing_lastname": "Copperfield",

    "billing_street_full": "Wallstreet 450",

    "billing_street": null,

    "billing_housenumber": null,

    "billing_housenumber_ext": null,

    "billing_postcode": "74983",

    "billing_city": "New York",

    "billing_region": "NY",

    "billing_country": "US",

    "billing_phone": "",

    "billing_email": "d.copperfield@gmail.com",

    "shipping_company": "Shoe Shop NY",

    "shipping_firstname": "Arnold",

    "shipping_lastname": "Schwarzenegger",

    "shipping_street_full": "Wallstreet 450",

    "shipping_street": null,

    "shipping_housenumber": null,

    "shipping_housenumber_ext": null,

    "shipping_postcode": "74983",

    "shipping_city": "New York",

    "shipping_region": "NY",

    "shipping_country": "US",

    "shipping_phone": "",

    "shipping_email": "a.schwarzenenegger@gmail.com",

    "shipping_method": "free_shipping",

    "options": {

        "packing": {

            "ogc": true

        },

        "carrier": {

            "name": "flatrate_flatrate",

            "type": "0000"

        }

    },

    "supplier_purchase_id": null,

    "delivery_at": null,

    "created_at": "2020-11-01 00:01:01",

    "updated_at": "2022-10-26 08:09:13",

    "status_text": "Processing",

    "type_text": "Sale",

    "flag_partial_text": "All",

    "changeable": [

        "status",

        "flag_partial",

        "related_id",

        "priority",

        "options",

        "billing_company",

        "billing_firstname",

        "billing_lastname",

        "billing_street_full",

        "billing_street",

        "billing_housenumber",

        "billing_housenumber_ext",

        "billing_postcode",

        "billing_city",

        "billing_region",

        "billing_country",

        "billing_phone",

        "billing_email",

        "shipping_company",

        "shipping_firstname",

        "shipping_lastname",

        "shipping_street_full",

        "shipping_street",

        "shipping_housenumber",

        "shipping_housenumber_ext",

        "shipping_postcode",

        "shipping_city",

        "shipping_region",

        "shipping_country",

        "shipping_phone",

        "shipping_email",

        "shipping_method"

    ],

    "possible_statuses": {

        "2": {

            "status": 9,

            "statusText": "Cancelled",

            "statusVerb": "Cancel"

        }

    },

    "can_rma": false,

    "is_closed": false,

    "aggregate": {

        "id": 48,

        "entity_id": 1,

        "type": 0,

        "source_id": "erp",

        "reference": "MAG200",

        "cod_amount": "0.00",

        "total_amount": "12.34",

        "currency": "EUR",

        "flag_partial": 0,

        "status": 1,

        "contact": "Shoe Shop NY",

        "item_qty": 18,

        "item_qty_to_kit": 0,

        "item_amount": "100.52",

        "item_qty_shipped": 0,

        "item_qty_allocated": 18,

        "item_amount_allocated": "86.16",

        "item_prc_allocated": 100,

        "item_prc_process": 0,

        "item_prc_shipped": 0,

        "has_kits": true,

        "created_at": "2020-11-01 00:01:01",

        "delivery_at": null,

        "priority": 0,

        "type_text": "Sale",

        "status_text": "Processing",

        "flag_partial_text": "All"

    },

    "items": [

        {

            "id": 204,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-chair",

            "reference": "21",

            "parent_id": null,

            "allocation_method": 3,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Chair",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "qty_reserved_initial": 0

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 205,

            "order_id": 48,

            "entity_id": 1,

            "sku": "ikea-table",

            "reference": "22",

            "parent_id": null,

            "allocation_method": 1,

            "qty": 12,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Ikea Table",

            "unit_price": "7.18",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": null,

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 206,

            "order_id": 48,

            "entity_id": 1,

            "sku": "IK-ASSEMBLE",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 2,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Product assembly guide - Ikea Chair",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        },

        {

            "id": 207,

            "order_id": 48,

            "entity_id": 1,

            "sku": "CHAIR-ARM",

            "reference": null,

            "parent_id": null,

            "allocation_method": 1,

            "qty": 4,

            "qty_cancelled": 0,

            "qty_allocated": null,

            "description": "Chair Arms",

            "unit_price": "0.00",

            "weight": "0.0000",

            "is_dummy": false,

            "custom_options": null,

            "options": {

                "is_accum": true

            },

            "created_at": "2022-10-26 08:09:12",

            "updated_at": "2022-10-26 08:09:12"

        }

    ]

}


Response 500 Error

{

  "error": {

    "message": "Order status prohibits changes to attribute [qty]. Allowed changes are []",

    "type": "Exception"

  }

}



Delete Order

Method: DELETE

URL:  /api/v3/demand/order-by-reference/REFERENCE?source_id=SOURCE-ID

URL:  /api/v3/demand/order/ID

Delete will only work for orders with state New and of type Sale. It will remove:

Sample Request

 /api/v3/demand/order-by-reference/MAG200?source_id=erp

or

 /api/v3/demand/order/48



Response 200 OK

"OK"

Response 500 Error

{

    "error": {

        "message": "Only orders with status NEW can be deleted.",

        "type": "Exception"

    }

}