paccurate.io
/
1 min
code examples curl location 'https //api paccurate io/' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "itemsets" { "weight" "", "dimensions" {}, "centerofmass" {} }, "boxtypes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxtypedefaults" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {}, "boxtype" {} }, "eye" {}, "packorigin" {}, "rules" \[ { "itemmatch" {}, "operation" "" } ] }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "itemsets" { "weight" "", "dimensions" {}, "centerofmass" {} }, "boxtypes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxtypedefaults" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {}, "boxtype" {} }, "eye" {}, "packorigin" {}, "rules" \[ { "itemmatch" {}, "operation" "" } ] }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //api paccurate io/", 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 //api paccurate io/") 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({ "itemsets" { "weight" "", "dimensions" {}, "centerofmass" {} }, "boxtypes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxtypedefaults" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {}, "boxtype" {} }, "eye" {}, "packorigin" {}, "rules" \[ { "itemmatch" {}, "operation" "" } ] }) response = https request(request) puts response read body import requests import json url = "https //api paccurate io/" payload = json dumps({ "itemsets" { "weight" "", "dimensions" {}, "centerofmass" {} }, "boxtypes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxtypedefaults" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {} }, "boxes" { "weightmax" "", "dimensions" {}, "centerofmass" {}, "ratetable" {}, "boxtype" {} }, "eye" {}, "packorigin" {}, "rules" \[ { "itemmatch" {}, "operation" "" } ] }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful pack { "boxes" \[ { "box" {} } ], "title" "", "built" "", "startedat" "", "version" "", "lenboxes" 0, "lenitems" 0, "lenunits" 0, "lenleftovers" 0, "totalcost" 0, "totalvolume" 0, "totalvolumenet" 0, "totalvolumeused" 0, "totalvolumeutilization" 0, "totalweight" 0, "packtime" 0, "rendertime" 0, "totaltime" 0, "leftovers" {}, "itemsortused" "", "itemsortreverseused" false, "boxtypechoicegoalused" "", "scripts" "", "styles" "", "svgs" \[ "" ], "orderid" "", "requestid" "", "images" \[ { "boxindex" 0, "format" "", "data" "" } ], "usedkeystem" "", "warnings" \[ "" ], "requestfingerprint" "", "responsefingerprint" "", "packuuid" "" }// bad request malformed or some other problem occurred processing the request { "message" "", "details" "", "code" 0 }// invalid input the request was well formed, but the parameters were contradictory, invalid, or otherwise somehow unable to be processed more information will be contained in the error details { "message" "", "details" "", "code" 0 }// rate limited without an api key, only 10 unique requests are allowed per day for testing or demonstration purposes note that a randomized pack repeated is only a single unique request { "message" "", "details" "", "code" 0 }// unexpected error { "message" "", "details" "", "code" 0 }