Purchasing API
...
Purchasing API Docs
Purchasing

Create/Update Purchase

code examples curl location globoff request put '/api/v1/purchases/{lookupby}/{identifier}' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "type" "", "purchase identifiers" { "sparklayer" "" }, "customer identifiers" {}, "dates" {}, "billing address" { "address line1" "", "city" "", "country code" "" }, "packages" "", "accounting files" \[ { "identifiers" {}, "data" "", "file type" "" } ], "custom fields" \[ { "name" "" } ], "metadata" \[ { "name" "", "value" "" } ] }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "type" "", "purchase identifiers" { "sparklayer" "" }, "customer identifiers" {}, "dates" {}, "billing address" { "address line1" "", "city" "", "country code" "" }, "packages" "", "accounting files" \[ { "identifiers" {}, "data" "", "file type" "" } ], "custom fields" \[ { "name" "" } ], "metadata" \[ { "name" "", "value" "" } ] }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("/api/v1/purchases/{lookupby}/{identifier}", 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("/api/v1/purchases/{lookupby}/{identifier}") http = net http new(url host, url port); request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "type" "", "purchase identifiers" { "sparklayer" "" }, "customer identifiers" {}, "dates" {}, "billing address" { "address line1" "", "city" "", "country code" "" }, "packages" "", "accounting files" \[ { "identifiers" {}, "data" "", "file type" "" } ], "custom fields" \[ { "name" "" } ], "metadata" \[ { "name" "", "value" "" } ] }) response = http request(request) puts response read body import requests import json url = "/api/v1/purchases/{lookupby}/{identifier}" payload = json dumps({ "type" "", "purchase identifiers" { "sparklayer" "" }, "customer identifiers" {}, "dates" {}, "billing address" { "address line1" "", "city" "", "country code" "" }, "packages" "", "accounting files" \[ { "identifiers" {}, "data" "", "file type" "" } ], "custom fields" \[ { "name" "" } ], "metadata" \[ { "name" "", "value" "" } ] }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses { "type" "order", "purchase identifiers" { "sparklayer" "63428136 658f 48a6 beb7 7f333dfd9686", "platform" "123456789", "internal" "", "visible" "b2b01123" }, "customer identifiers" { "sparklayer" "cu 123", "sparklayer impersonator" "cu 123", "sparklayer child" "cu 123" }, "payment method" "", "dates" { "created at" "2020 01 01t00 00 00+02 00", "updated at" "2020 01 01t00 00 00+02 00", "placed at" "2020 01 01t00 00 00+02 00", "calculated submitted at" "2020 01 01t00 00 00+02 00" }, "customer reference" "po number", "currency code" "gbp", "calculated shipping address" "john spark, sparklayer, sparklayer hq, example city, 12345", "calculated total" {}, "calculated total usd" {}, "calculated fulfilment status" "processing", "revision date" "2020 01 01t00 00 00+02 00", "billing address" { "name" "tom jones", "company" "tom jones hardware ltd", "address line1" "7 philosophy way", "address line2" "", "city" "willerby", "region code" "", "postal code" "bj6 9mk", "country code" "gb", "phone" "0123456789", "sparklayer id" "ca 100" }, "packages" {}, "accounting files" \[ { "identifiers" { "internal" "inv011", "visible" "" }, "data" {}, "file type" "invoice" } ], "custom fields" \[ { "name" "delivery date", "value" "2023 10 28" } ], "metadata" \[ { "name" "example key", "value" "1234" } ] }// trying to update purchase sparklayer id, which is immutable // error response // a conflict has occurred // error response