Load App APIs
Demand State Management
Update demand state
1 min
code examples curl location globoff request put 'https //{tenantsubdomain}/tms/api/v1/demands/state/{demand id}' \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "action" "" }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "action" "" }); var requestoptions = { method 'put', headers myheaders, body raw, redirect 'follow' }; fetch("https //{tenantsubdomain}/tms/api/v1/demands/state/{demand 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 //{tenantsubdomain}/tms/api/v1/demands/state/{demand id}") https = net http new(url host, url port) https use ssl = true request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "action" "" }) response = https request(request) puts response read body import requests import json url = "https //{tenantsubdomain}/tms/api/v1/demands/state/{demand id}" payload = json dumps({ "action" "" }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // demand state updated successfully { "data" { "data" { "id" "" }, "request" { "uri" "", "method" "", "querystring" "", "body" { "eventcode" "", "timestamp" 0, "source" { "appid" "" }, "callback" { "url" "", "meta" { "allocationtype" "", "reason" "", "additional metadata" "", "uniquecode" "", "timestamp" 0 } } } } }, "success" false }// bad request { "success" false, "error" "", "validation errors" \[ { "field" "", "message" "" } ] }// demand not found { "success" false, "error" "", "error code" "" }// internal server error { "success" false, "error" "", "error code" "" }
