JSON Data Retrieval API
-
- UpdatedJan 30, 2025
- 3 minutes to read
- Yokohama
- API implementation
Query for data by issuing an HTTPS GET request to the instance.
By default, a GET request is interpreted as a get function if a sysparm_sys_id parameter is present. Otherwise, it is interpreted as a getRecords function. You can also specify a URL parameter sysparm_action=get. Query responses are always encapsulated by a records hash of records, where each individual record's values are themselves hashed by field name.
Return Display Value for Reference Variables
sys_id
for another table. The base system behavior is to return the
sys_id
value for those fields. To have the display value for the field
returned, use one of these options:- Add the property glide.json.return_displayValue to the system properties, and every JSON request will return a display value for a reference field.
- Add the parameter displayvalue=true to the JSON request URL and
JSON requests with that parameter will return a display value instead of the
sys_id
for a reference field. The JSON URL would look like this: - Add the parameter displayvalue=all to the JSON request URL and
JSON requests with that parameter return a display value and the
sys_id
for a reference field. The response element name for the display value field will be prefixed withdv_
, for exampledv_caller_id
.
Get variables
Use the displayvariables query parameter to return an array of variables associated with a Service Catalog item record. To get variables, add the parameter displayvariables=true to the JSON request URL. For example, here is a URL to retrieve a record in JSON format that includes Service Catalog variables:
The keys in the response are defined as follows:
Control the order of records
You can control the order that records appear in the JSON response. To set an order, use the ORDERBY or ORDERBYDESC clauses in the URL encoded query. For example,
filters all active records and orders the results in ascending order by number first, and then in descending order by category. For more information, see Encoded query strings.
getKeys
sys_id
of multiple records by specifying an encoded query string in
the sysparm_query
parameter.get
sys_id
in a
sysparm_sys_id
parameter.