cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

REST API HELP

We are trying to extract Incident ticket data from ServiceNow to Power BI using Rest API. We are able to bring Incident tickets data from ServiceNow but our client requirement is,

 

We have Table called ‘X’ in Power BI and in that table have Incident number column and which is having latest to 2 year old data.

 

Now we need to have functionality like, pick the incident number from X table and that Ticket number should validate and bring matching data from ServiceNow RESTAPI. It means, whatever the data we have in X table only those incidents should come from ServiceNow REST API.

1 ACCEPTED SOLUTION
RicoZhou
Community Support
Community Support

Hi @Anonymous 

Currently, you are succeed to get data from ServiceNow to Power BI using Rest API. Now your requirement is to filter data by incident number in Table X.  Try to update your api to invoke incident number list from Table X.

Here I a sample query to get version from sharepoint by api.

 

let
    Source = (VersionsRelevantSharePointListName as text, VersionsRelevantSharePointLocation as text, VersionsRelevantItemID as number) => let
        Source = Xml.Tables(Web.Contents(Text.Combine({
    VersionsRelevantSharePointLocation,
    "/_api/web/Lists/getbytitle('",
    VersionsRelevantSharePointListName ,
    "')/items(",
    Text.From(VersionsRelevantItemID),
    ")/versions"}
    ))),
        entry = Source{0}[entry],
        #"Removed Other Columns2" = Table.SelectColumns(entry,{"content"}),
        #"Expanded content" = Table.ExpandTableColumn(#"Removed Other Columns2", "content", {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}, {"content"}),
        #"Expanded content1" = Table.ExpandTableColumn(#"Expanded content", "content", {"properties"}, {"properties"}),
        #"Expanded properties" = Table.ExpandTableColumn(#"Expanded content1", "properties", {"http://schemas.microsoft.com/ado/2007/08/dataservices"}, {"properties"})
    in
        #"Expanded properties"
in
    Source

 

It looks like as below.

1.png

Invoke list with this query and add parameters into query, then expand the table to get your result.

1.png

So you just need to filter incident number list from X table to filter the result in power query.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

 

View solution in original post

3 REPLIES 3

Hello,

Much easier way would be using out Power BI Connector for ServiceNow app:

We have a handy User and Admin Guides for your convenience, but feel free to reach out support team at support@alpha-serve.com if you need any assistance.

 

Thank you.

Regards,

Anton

===

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

RicoZhou
Community Support
Community Support

Hi @Anonymous 

Currently, you are succeed to get data from ServiceNow to Power BI using Rest API. Now your requirement is to filter data by incident number in Table X.  Try to update your api to invoke incident number list from Table X.

Here I a sample query to get version from sharepoint by api.

 

let
    Source = (VersionsRelevantSharePointListName as text, VersionsRelevantSharePointLocation as text, VersionsRelevantItemID as number) => let
        Source = Xml.Tables(Web.Contents(Text.Combine({
    VersionsRelevantSharePointLocation,
    "/_api/web/Lists/getbytitle('",
    VersionsRelevantSharePointListName ,
    "')/items(",
    Text.From(VersionsRelevantItemID),
    ")/versions"}
    ))),
        entry = Source{0}[entry],
        #"Removed Other Columns2" = Table.SelectColumns(entry,{"content"}),
        #"Expanded content" = Table.ExpandTableColumn(#"Removed Other Columns2", "content", {"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"}, {"content"}),
        #"Expanded content1" = Table.ExpandTableColumn(#"Expanded content", "content", {"properties"}, {"properties"}),
        #"Expanded properties" = Table.ExpandTableColumn(#"Expanded content1", "properties", {"http://schemas.microsoft.com/ado/2007/08/dataservices"}, {"properties"})
    in
        #"Expanded properties"
in
    Source

 

It looks like as below.

1.png

Invoke list with this query and add parameters into query, then expand the table to get your result.

1.png

So you just need to filter incident number list from X table to filter the result in power query.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

 

lbendlin
Super User
Super User

Add a custom column to your table, construct the URL for the incident in each row and then use Web.Contents to pull the individual records.  Then expand that new column as needed. Is the data in XML or in JSON?

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.