This Scripted REST API provides a list of all populated variables on a RITM. It’s provided for free and without advertising.
Note: Currently, this returns only actual values, not display values. Version 2.1 will include the ability to get either or both, when I have time to add that functionality.
Usage
Endpoint: GET https://INSTANCE.service-now.com/api/13231/ritm_vars_api
Header: “ritm” - a comma-separated list of RITM numbers (ex: RITM001003) to retrieve all populated variables for.
Response: A JSON-formatted object “result” with one node for each RITM that was requested and found. The RITM nodes are objects, which themselves contain a key/value pair for each populated variable associated with that RITM, where the key is the variable name, and the value is the variable’s value.
Example request (JavaScript)
var requestBody = ""; var client = new XMLHttpRequest(); client.open("get", "https://INSTANCE.service-now.com/api/13231/ritm_vars_api"); client.setRequestHeader('Accept', 'application/json'); client.setRequestHeader('Content-Type', 'application/json'); client.setRequestHeader('ritm', 'RITM0010003,RITM0010002'); //Eg. UserName="admin", Password="admin" for this code sample. client.setRequestHeader('Authorization', 'Basic ' + btoa('USERNAME' + ':' + 'PASSWORD')); client.onreadystatechange = function() { if (this.readyState == this.DONE) { document.getElementById("response").innerHTML = this.status + this.response; } }; client.send(requestBody);
Example response
{ "result": { "RITM0010003": { "number": "RITM0010003", "some_var_name": "var value here" }, "RITM0010002": { "number": "RITM0010002", "string_var_name": "some variable value here", "reference_var_name": "9022f73e37ec730090b68cf6c3990e8e" } } }