Order Service
Batch Order
Create orders in batch
1 min
code examples curl location globoff 'https //{base url}/core/api/v1/orders/batch' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{"body" {"payload" \["string","string",{"contact" {},"location" {}},{"clientid" "string","clientorderid" "string"},{"orderdescription" "string","totalweight" {},"totalordercost" {}},\["string","string",{"contact" {},"location" {},"pickupslot" {}},{"contact" {},"location" {},"returnslot" {}},{"deliveryslot" {}},{},{},"string\<move container | physical service | digital service>"],{}],"callback" {"meta" {}},"onrequest" {"url" "string","requestheader" {},"requestbody" {},"method" "string","onresponse" {"wait"\ false}},"onerror" {"url" "string","requestheader" {},"requestbody" {},"method" "string","onresponse" {}}}}'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "body" { "payload" \[ "string", "string", { "contact" {}, "location" {} }, { "clientid" "string", "clientorderid" "string" }, { "orderdescription" "string", "totalweight" {}, "totalordercost" {} }, \[ "string", "string", { "contact" {}, "location" {}, "pickupslot" {} }, { "contact" {}, "location" {}, "returnslot" {} }, { "deliveryslot" {} }, {}, {}, "string\<move container | physical service | digital service>" ], {} ], "callback" { "meta" {} }, "onrequest" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "onresponse" { "wait" false } }, "onerror" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "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({ "body" { "payload" \[ "string", "string", { "contact" {}, "location" {} }, { "clientid" "string", "clientorderid" "string" }, { "orderdescription" "string", "totalweight" {}, "totalordercost" {} }, \[ "string", "string", { "contact" {}, "location" {}, "pickupslot" {} }, { "contact" {}, "location" {}, "returnslot" {} }, { "deliveryslot" {} }, {}, {}, "string\<move container | physical service | digital service>" ], {} ], "callback" { "meta" {} }, "onrequest" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "onresponse" { "wait" false } }, "onerror" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "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({ "body" { "payload" \[ "string", "string", { "contact" {}, "location" {} }, { "clientid" "string", "clientorderid" "string" }, { "orderdescription" "string", "totalweight" {}, "totalordercost" {} }, \[ "string", "string", { "contact" {}, "location" {}, "pickupslot" {} }, { "contact" {}, "location" {}, "returnslot" {} }, { "deliveryslot" {} }, {}, {}, "string\<move container | physical service | digital service>" ], {} ], "callback" { "meta" {} }, "onrequest" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "onresponse" { "wait" false } }, "onerror" { "url" "string", "requestheader" {}, "requestbody" {}, "method" "string", "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" "" } }