Core API
...
Core API Docs
Discounts

Update a Discount

code examples curl location globoff request patch 'https //app sparklayer io/api/v1/discounts/{id}' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "internal name" "", "internal slug" "", "calculation group" "", "priority" "", "times applicable per order" "", "groups" "", "requirement selection type" "", "reward selection type" "", "currency code" "", "start date" "", "end date" "", "active" "", "requirements" \[ { "items" \[ { "restrictions" \[ { "type" "", "ref" "" } ], "points type" "", "points" 1, "quantity" "", "selection type" "" } ], "max rewards" "", "min spend" "", "max spend" "", "spend tax type" "", "selection type" "", "min points" "" } ], "rewards" \[ { "type" "", "amount type" "", "item id" "", "amount" "" } ], "other requirements" "" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "internal name" "", "internal slug" "", "calculation group" "", "priority" "", "times applicable per order" "", "groups" "", "requirement selection type" "", "reward selection type" "", "currency code" "", "start date" "", "end date" "", "active" "", "requirements" \[ { "items" \[ { "restrictions" \[ { "type" "", "ref" "" } ], "points type" "", "points" 1, "quantity" "", "selection type" "" } ], "max rewards" "", "min spend" "", "max spend" "", "spend tax type" "", "selection type" "", "min points" "" } ], "rewards" \[ { "type" "", "amount type" "", "item id" "", "amount" "" } ], "other requirements" "" }); var requestoptions = { method 'patch', headers myheaders, body raw, redirect 'follow' }; fetch("https //app sparklayer io/api/v1/discounts/{id}", 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 //app sparklayer io/api/v1/discounts/{id}") https = net http new(url host, url port) https use ssl = true request = net http patch new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "internal name" "", "internal slug" "", "calculation group" "", "priority" "", "times applicable per order" "", "groups" "", "requirement selection type" "", "reward selection type" "", "currency code" "", "start date" "", "end date" "", "active" "", "requirements" \[ { "items" \[ { "restrictions" \[ { "type" "", "ref" "" } ], "points type" "", "points" 1, "quantity" "", "selection type" "" } ], "max rewards" "", "min spend" "", "max spend" "", "spend tax type" "", "selection type" "", "min points" "" } ], "rewards" \[ { "type" "", "amount type" "", "item id" "", "amount" "" } ], "other requirements" "" }) response = https request(request) puts response read body import requests import json url = "https //app sparklayer io/api/v1/discounts/{id}" payload = json dumps({ "internal name" "", "internal slug" "", "calculation group" "", "priority" "", "times applicable per order" "", "groups" "", "requirement selection type" "", "reward selection type" "", "currency code" "", "start date" "", "end date" "", "active" "", "requirements" \[ { "items" \[ { "restrictions" \[ { "type" "", "ref" "" } ], "points type" "", "points" 1, "quantity" "", "selection type" "" } ], "max rewards" "", "min spend" "", "max spend" "", "spend tax type" "", "selection type" "", "min points" "" } ], "rewards" \[ { "type" "", "amount type" "", "item id" "", "amount" "" } ], "other requirements" "" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("patch", url, headers=headers, data=payload) print(response text) responses // successful response { "id" "942651af f950 4716 9916 16170fe0645f", "created at" "", "deleted at" "", "updated at" "", "name" "", "internal name" "", "internal slug" "", "calculation group" 0, "priority" 0, "times applicable per order" 0, "max rewards" 0, "groups" \[ "default" ], "simultaneity" \[ "default" ], "requirement selection type" "", "reward selection type" "", "currency code" "gbp", "start date" "", "end date" "", "active" false, "requirements" \[ { "items" \[ { "restrictions" \[ { "type" "", "ref" "" } ], "points type" "", "points" 0, "quantity" 0, "selection type" "" } ], "max rewards" 0, "min spend" 0, "max spend" 0, "spend tax type" "", "selection type" "", "min points" 0 } ], "rewards" \[ { "type" "", "amount type" "", "item id" "", "amount" 0 } ], "other requirements" \[ {} ] }// error response