Marketing API
Discounts
Duplicate Discount
this api endpoint (post) (post) duplicates an existing discount if the request succeeds, it returns the newly created discount object docid\ y 9znrh28cmsoyhovk7fm otherwise, it will return an error permissions discounts create webhook event discount events docid\ amoqkwqv4lrhgmpdygehw path parameters id the id of the discount to duplicate require "uri" require "json" require "net/http" url = uri("https //api tamio com/v2/discounts/duplicate/00b8af22 f9f9 41f9 a71f dc8710af876f") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["authorization"] = "bearer your token here" response = https request(request) puts response read bodycurl location request post 'https //api tamio com/v2/discounts/duplicate/00b8af22 f9f9 41f9 a71f dc8710af876f' \\ \ header 'accept application/json' \\ \ header 'authorization bearer your token here'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("authorization", "bearer your token here"); var requestoptions = { method 'post', headers myheaders }; fetch("https //api tamio com/v2/discounts/duplicate/00b8af22 f9f9 41f9 a71f dc8710af876f", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));{ "status" 200, "discount" { "id" "13316518 3fc8 4418 b14f e8efea620d43", "label" "black friday 50% off", "currency" "eur", "percent off" 50, "object" "discount", "amount off" 0, "shipping percent off" 0, "shipping amount off" 0, "active" false, "type" "product discount", "payments" \[ "all" ], "created at" 1669130701, "expiry date" null, "block affiliates" false, "destinations" \[ "worldwide" ], "condition" "coupon", "applies to" "selected products", "rule amount" null, "subscription discount duration" "forever", "number of months" null, "domain" null, "coupon" "blackfriday2022", "coupon max redemptions" 100, "coupon times redeemed" 0, "products" \[ "5a3da42d d007 49e0 937d 8388d45ba05e" ] } }