Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Data refreshes in Desktop but not in Service

Hello community,

I succeed getting data from LiveChat by using Web API. The data refreshes in Desktop, but not in Service. I get the following error:

"You can't schedule refresh for this dataset because the following data sources currently don't support refresh:

Data source for LiveChat
Discover Data Sources

Query contains unsupported function. Function name: Web.Contents"

A part of the M script looks like this:

let

    Source = Json.Document(Web.Contents("https://api.livechatinc.com/v2/chats?date_from=" & date_from & "&date_to=" & date_to)),

    #"Converted to Table" = Record.ToTable(Source),

    GetPage = #"Converted to Table"{2}[Value],

              Pages = Table.FromList(List.Generate(

              ()=>GetPage,

              each _ > 0,

              each _ -1),

              Splitter.SplitByNothing(),

              {"Page"},

              null,

              ExtraValues.Error),

    #"Invoked Custom Function" = Table.AddColumn(Pages, "Transcript", each Pagination([Page])),

 

Then I tried to change the M script using RelativePath and Query to:

let

    Source = Json.Document(Web.Contents("https://api.livechatinc.com/",

              [RelativePath="v2/chats",

              Query=[date_from=date_from,date_to=date_to]])),

    #"Converted to Table" = Record.ToTable(Source),

    GetPage = #"Converted to Table"{2}[Value],

              Pages = Table.FromList(List.Generate(

              ()=>GetPage,

              each _ > 0,

              each _ -1),

              Splitter.SplitByNothing(),

              {"Page"},

              null,

              ExtraValues.Error),

    #"Invoked Custom Function" = Table.AddColumn(Pages, "Transcript", each Pagination([Page])),

 

 

And again, in Desktop it refreshes but in Service I get the same error. Can someone help me?

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Based on the error, i would simply assume that it doesn't support refreshing of "live chat".  Looking at your code, i personally use a similar Json(Web.Contents) for an API and have no problems with refreshing.  I'm not using Live Chat, so there could be something causing an issue there.

     

    Where there might be some differences:

    1.  I'm using Table.FromList inside my "Converted to Table" row.  It looks like:

     

    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Expanded Columns" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"yourSourceColumn1", "yourSourceColumn2", "yourSourceColumn3", "yourSourceColumn4", "yourSourceColumn5"}, {"yourRenamedColumn1", "yourRenamedColumn2", "yourRenamedColumn3", "yourRenamedColumn4", "yourRenamedColumn5"}),​

     

    • Ive loaded this into my Gateway as a connection of "Web"
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for you message. I am wondering if maybe the token part is causing the error. I still haven't found a solution. If I find it I will post it.