Get external data via REST Data Broker

GC-Portal-Team
Tera Contributor

Hi all!

I am trying to surface data from an external, public API (ex, https://datausa.io/api/data?drilldowns=Nation&measures=Population) on a Page within UI Builder.

I am new at SNOW❄️ but it seems possible to do it in UI Builder, by

1. Add "Data resource instance":

find_real_file.png

 

2. Add new "REST" Data resource:

find_real_file.png

 

3. Configure a GET request and specify the API URL under the "API" field:

find_real_file.png

4. Add it via UI Builder > "Data resource instances" > + Add > App > Data resource > "get datausa entries" > Add

find_real_file.png

 

BUT, I get a "Requested URI does not represent any resource" error message:

find_real_file.png

 

Kindly let me know if there is a different approach and where I could have gone wrong.

 

Many thanks!

 

❄️

1 ACCEPTED SOLUTION

j_15
Tera Expert

You can make a request to an external REST API from within UI Builder following these high-level steps:

 

1. Create a new REST Message record with a GET method configured for your REST API endpoint.

2. Create a new Transform Data Resource inside UI Builder

3. Before you use the Transform Data Resource you need to create an ACL for it (type: "ux_data_broker", operation: "execute", name: sys_id of the Transform Data Resource)

4. Invoke the REST Message from within the Script section of the Transform Data Resource.

 

I've explained this in more detail in the video below:

 

View solution in original post

4 REPLIES 4

WORKFLOW-COWBOY
ServiceNow Employee
ServiceNow Employee

I think that feature is for referring to REST APIs on the same ServiceNow instance and not remote resources.  

If you look at the out of the box records on the "REST Data Broker" [sys_ux_data_broker_rest] table this seem to be the case with the OOB records. 

Another way to do what you are trying to do would be to use a Data Stream and a Remote Table instead. 

Then, call the Remote Table as a regular GlideRecord Query. 


--------------------------------------------------
Workflow Cowboy
LinkedIn: https://www.linkedin.com/in/dalestubblefield/
YouTube: https://www.youtube.com/@starlordnow

Here is a similar Community post:

https://community.servicenow.com/community?id=community_question&sys_id=15ab742a1b577850acdc54e56b4b...


--------------------------------------------------
Workflow Cowboy
LinkedIn: https://www.linkedin.com/in/dalestubblefield/
YouTube: https://www.youtube.com/@starlordnow

Thanks for the reply.

The post you linked to is using an internal ServniceNow API (/api/now/...).

 

I am trying to send a request to an external, public API URL: https://datausa.io/api/data?drilldowns=Nation&measures=Population

j_15
Tera Expert

You can make a request to an external REST API from within UI Builder following these high-level steps:

 

1. Create a new REST Message record with a GET method configured for your REST API endpoint.

2. Create a new Transform Data Resource inside UI Builder

3. Before you use the Transform Data Resource you need to create an ACL for it (type: "ux_data_broker", operation: "execute", name: sys_id of the Transform Data Resource)

4. Invoke the REST Message from within the Script section of the Transform Data Resource.

 

I've explained this in more detail in the video below: