Order Service
Batch Order
Create orders in batch
1min
code examples curl location globoff 'https //{base url}/core/api/v1/orders/batch' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "payload" \[ { "shipmentflow" "", "workorderflowtype" "", "dropdetails" { "contact" "", "location" "" }, "clientdetails" { "clientid" "", "clientorderid" "" }, "ordersummary" { "orderdescription" "" }, "workorders" \[ { "servicetemplateid" "", "servicetemplatename" "", "pickupdetails" { "contact" {}, "location" {} }, "type" "" } ] } ], "onrequest" { "url" "", "requestheader" "", "method" "", "onresponse" { "wait" "" } }, "onerror" { "url" "", "requestheader" "", "method" "", "onresponse" {} } }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "payload" \[ { "shipmentflow" "", "workorderflowtype" "", "dropdetails" { "contact" "", "location" "" }, "clientdetails" { "clientid" "", "clientorderid" "" }, "ordersummary" { "orderdescription" "" }, "workorders" \[ { "servicetemplateid" "", "servicetemplatename" "", "pickupdetails" { "contact" {}, "location" {} }, "type" "" } ] } ], "onrequest" { "url" "", "requestheader" "", "method" "", "onresponse" { "wait" "" } }, "onerror" { "url" "", "requestheader" "", "method" "", "onresponse" {} } }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //{base url}/core/api/v1/orders/batch", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //{base url}/core/api/v1/orders/batch") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "payload" \[ { "shipmentflow" "", "workorderflowtype" "", "dropdetails" { "contact" "", "location" "" }, "clientdetails" { "clientid" "", "clientorderid" "" }, "ordersummary" { "orderdescription" "" }, "workorders" \[ { "servicetemplateid" "", "servicetemplatename" "", "pickupdetails" { "contact" {}, "location" {} }, "type" "" } ] } ], "onrequest" { "url" "", "requestheader" "", "method" "", "onresponse" { "wait" "" } }, "onerror" { "url" "", "requestheader" "", "method" "", "onresponse" {} } }) response = https request(request) puts response read body import requests import json url = "https //{base url}/core/api/v1/orders/batch" payload = json dumps({ "payload" \[ { "shipmentflow" "", "workorderflowtype" "", "dropdetails" { "contact" "", "location" "" }, "clientdetails" { "clientid" "", "clientorderid" "" }, "ordersummary" { "orderdescription" "" }, "workorders" \[ { "servicetemplateid" "", "servicetemplatename" "", "pickupdetails" { "contact" {}, "location" {} }, "type" "" } ] } ], "onrequest" { "url" "", "requestheader" "", "method" "", "onresponse" { "wait" "" } }, "onerror" { "url" "", "requestheader" "", "method" "", "onresponse" {} } }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // accepted { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} }, "data" { "batchid" "", "orders" \[ { "id" "" } ] } }// error occurred { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} }, "data" { "id" "" } }// error occurred { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} }, "data" { "id" "" } }// error occurred { "error" { "code" "", "description" "", "additionalinfo" {} }, "request" { "uri" "", "method" "", "querystring" "", "body" {} }, "data" { "id" "" } }