Tally Platform API
coupon-compensation
Add Compensation Nights
1 min
code examples curl location globoff 'https //api b preview\ loyaltyservices io/api/v4/compensation/{compensationid}/nights' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '\[ {} ]'require "uri" require "json" require "net/http" url = uri("https //api b preview\ loyaltyservices io/api/v4/compensation/{compensationid}/nights") 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(\[ {} ]) response = https request(request) puts response read body import requests import json url = "https //api b preview\ loyaltyservices io/api/v4/compensation/{compensationid}/nights" payload = json dumps(\[ {} ]) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) okhttpclient client = new okhttpclient() newbuilder() build(); mediatype mediatype = mediatype parse("application/json"); requestbody body = requestbody create(mediatype, "\[\n {}\n]"); request request = new request builder() url("https //api b preview\ loyaltyservices io/api/v4/compensation/{compensationid}/nights") method("post", body) addheader("accept", "application/json") addheader("content type", "application/json") build(); response response = client newcall(request) execute(); responses // success \[ { "compensationdate" "", "compensationnightstatus" "processed", "compensationdetailamounts" \[ { "couponuseamount" 0, "category" "", "reason" "" } ] } ]// bad request { "errors" \[ { "code" "", "fieldname" "", "message" "", "messageparameters" \[ {} ] } ] }// unauthorized // forbidden // internal error