Web API request ====== Handles ====== Returns a JSON object with all user-created handles in the current show. ^ API | Not in the online API documentation but in the [[https://www.avolites.com/LinkClick.aspx?fileticket=h90tNOJgRmg%3d&tabid=828&portalid=0&mid=3203|Web API manual]]. | ^ namespace | | ^ usage | ''%% http://[ip]:4430/titan/handles %%'' \\ \\ can be extended by a handle group to show only these handles, e.g. \\ ''%% http://[ip]:4430/titan/handles/Fixtures %%''\\ \\ can be further extended by a page number of this handle group, e.g.\\ ''%% http://[ip]:4430/titan/handles/Fixtures/1 %%'' | ^ example | [[+tab|http://localhost:4430/titan/handles]] (link opens in new tab) | ^ action | none | ^ returns | JSON object with all user-created handles. | ^ remarks | Lists only user-created handles. Some handle groups are not shown, e.g. any handles on the Mobile Wing. | In order to view the JSON I recommend [[https://notepad-plus-plus.org|Notepad++]] with the JSON Viewer extension, but there are countless viewers available: online as well as standalone programs or for your preferred development platform.. In order to parse the JSON you might use e.g. ''JSON.parse'', see [[webapi:examples:titanids]]. Some interesting fields: * handleLocation: the location of the handle, e.g. which window, page, and index * userNumber: the usernumber * legend: the legend (if it is a string * active: whether a playback is active, i.e. fired (see [[https://www.facebook.com/groups/1811437589141428/permalink/2613998708885308/?comment_id=2614154352203077|this facebook post]]) ==== Screenshots ==== | {{:webapi:requests:handles_1.png?430|handles request and JSON object}}\\ handles request and JSON object | {{:webapi:requests:handles_2.png?400|JSON in a JSON viewer}}\\ JSON in a JSON viewer | ==== Parsing the JSON (snippet/example) ==== ... // parse the JSON var myArr = JSON.parse(this.responseText); var field_un = "userNumber"; var field_le = "legend"; if (version < 12) { field_un = "UserNumber"; field_le = "Legend"; } // write number of handles somewhere document.getElementById("num_handles").innerHTML = myArr.length; ... // loop through the array and write its contents for (var i = 0; i < myArr.length; i++) { // set the background colour based on the handle type bgcol = "#FFFFFF"; if (myArr[i]["type"] == 'masterHandle') bgcol = "#FFdddd"; ... // get handle usernumber handleUn = myArr[i][field_un].userNumbers; if (handleUn == null) handleUn = ""; ... // get type and titanId and write it somewhere txt += "" + handleUn + ""; txt += "" + myArr[i]["type"] + ""; txt += "" + myArr[i]["titanId"] + ""; } ==== Used In ==== {{backlinks>.}}