Forum Discussion

antara_centri's avatar
antara_centri
Frequent Visitor
2 years ago

Hello All,I am trying to integrate ServiceNow with Power BI

Hello,

I am trying to integrate ServiceNow with Power BI.

 

I have created a database view in ServiceNow and using the REST API EXPLORER  created the API calls.so far I have around 200000 records in the database view so my API calls are as below.

 

On first attempt  URL1: /api/now/table/incident?sysparm_limit=10000&sysparm_offset=0

Next with URL2: /api/now/table/incident?sysparm_limit=10000&sysparm_offset=10000

URL3: /api/now/table/incident?sysparm_limit=10000&sysparm_offset=20000

....

...

...

URL200: /api/now/table/incident?sysparm_limit=10000&sysparm_offset=200000

 

Then I have to get the newer data in in power BI as well.I am trying to understand what will be the best way to achieve this.

 

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi antara_centri ,

    Roughly the process can be to first generate a list of the API, then use a custom function to call the API, and then according to the results returned, for example, if the number of records exceeded the part of the return error you can use try...otherwise...to catch the error, or filter <>null if it returns null if it exceeds the number of records, and finally combine the expanded data.
    This is a reference code:

    let
            GetData = () =>
            let
                TotalRecords = 200000, // Adjust based on your actual record count
                PageSize = 10000,
                PageCount = Number.RoundUp(TotalRecords / PageSize) + 1,
                Source = List.Generate(
                    () => 0,
                    each _ < PageCount,
                    each _ + PageSize,
                    each 
                        let
                            Offset = _ * PageSize,
                            URL = "https://baseurl/api/now/table/incident?sysparm_limit=" & Text.From(PageSize) & "&sysparm_offset=" & Text.From(Offset),
                            Data = try CustomFuntiontoCallAPI(URL) otherwise null
                        in
                            Data
                ),
                FilteredSource = List.Select(Source, each _ <> null),
                CombinedData = Table.Combine(FilteredSource)
            in
                CombinedData
        in
            GetData

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

    • antara_centri's avatar
      antara_centri
      Frequent Visitor

      Hello jennjenn can you kindly elaborate on how you are using it now.I am a newbie and finding it difficult.I tried looking up but could not find much to connect via sql.