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.

How to run reports query using rest API

Shetty2
Mega Contributor

I have written a query to get list of demands and saved. My query is to filter demands and demand tasks. When I view/Run query I see output table.

I want list of demands which is the output of query as my API response.

 

 

find_real_file.png

1 ACCEPTED SOLUTION

@Shetty@20 

no other option

You cannot use related list condition query containing RLQUERY in the API explorer sysparm_query

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Steps

1) visit API explorer in left nav

2) Select table as "dmn_demand"

3) Copy the query and use that in sysparm_query

4) consume the endpoint

Note: I didn't test this. but I doubt the related list condition may not work

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Akur,

I do not have an access to API explorer, but i tried API with sys param but it is not giving the demand list.

 

https://SnowURL/api/now/table/sys_report/sysId?&sysparm_query=u_gate_2_approval_date>=javascript:gs.beginningOfYesterday()^RLQUERYu_demand_task.parent,>=1^assigned_to=sysid^ENDRLQUERY

@Shetty@20 

even if you apply it won't get from the API explorer

I just checked and it won't work

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar So there is any way to run reports query through API? Or we have to use UI for running query?