Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Extract RITM data via API

Lakshay Verma
Kilo Explorer

I am new to Service Now as well as API , So my question could be as silly as one could imagine.

Need to extract information via API 

I am using API and sc_req_item to fetch the data.

Request : -https://test.service-now.com/api/now/table/sc_req_item?sysparm_query=active%3Dtrue%5Eshort_descriptionSTARTSWITHTest%20Connect%5Eapproval%3Drequested%5EstateNOT%2C-5%2C-25%2C6%2C3%2C4%26

I have used OAuth 2.0

I was able to extract much of the data via above request, however on a customer request tab, there is a table for which i was not able to extract data.

I am attaching SS for review.

 

 

3 REPLIES 3

Vasantharajan N
Tera Sage
Tera Sage

Those are called variables. If you know the variable name then you can use sysparm_fields query parameter to get the details, when you use the sysparm_fields in your API endpoint then the result JSON will contain values of the fields you mentioned

sysparm_fields=number,variables.short_description,variables.description

https://test.service-now.com/api/now/table/sc_req_item?sysparm_fields=number,variables.<variable_name>,variables.<variable_name>&sysparm_query=active%3Dtrue%5Eshort_descriptionSTARTSWITHTest%20Connect%5Eapproval%3Drequested%5EstateNOT%2C-5%2C-25%2C6%2C3%2C4%26

Sample Response:

I've just used number and 2 variables in the sysparm_fields query parameter so I'm getting the response as shown in the below screenshot.

find_real_file.png


Thanks & Regards,
Vasanth

Hi @Vasantharajan N Those are not variables rather part of sc_multi_row_question_answer

I queried them via ParentID(SysID) and able to get the result.

https://test.service-now.com/api/now/table/sc_multi_row_question_answer?parent_id=g654478qn45yy72hhsq541g567ytre9&sysparam_display_value=true&sysparam_fields

 

Which give me a desired result as expected

 

Thanks for your reply.

@Lakshay Verma - FYI : Those are one of the variable type (In your case you are interested in multi row variables which is "Units" as per your screenshot).


Thanks & Regards,
Vasanth