Forum Discussion

NickoB72's avatar
NickoB72
Frequent Visitor
2 years ago

API request gets stuck at 'evaluating.'

Hi.
I'm using this query for an API request (POST) to change data from JSON into a table.
It works like a charm the first time, but when I try to refresh, the query times out or gets stuck at 'evaluating.'
Anyone that has an idea what the problem is?

 

 

 

let
    Source = Json.Document(
        Web.Contents(
            UrlAPI,
            [
                Headers=[
                    #"Content-Type"="application/json",
                    #"Authorization"="Bearer " & Token
                ],
                Content=Text.ToBinary("{}"),
                RelativePath=""
            ]
        )
    ),
    Headers = Record.FieldNames(Source[data][headers]),
    Rows = Source[data][rows],
    Records = List.Transform(Rows, each Record.FromList(_, Headers)),
    APIPost = Table.FromRecords(Records)
in
    APIPost

 

 

 

 

3 Replies

  • "Evaluating..."  means you changed the meta data, Power Query panicked, threw up, and now tries to remember what everything means. That includes rebuilding its meta data cache, and can take any number of minutes. The "simplest"  advice is to wait it out.  After that everything will be fine until the next meta data change.  Which in your scenario seems to be every time you make that API call?

     

    The ideal final result of a Power Query query is a partition (a table in layman's terms) that has exactly the same structure as the run before .

    • NickoB72's avatar
      NickoB72
      Frequent Visitor

      I've tried waiting, but it times out. I also cannot refresh the data source in "Transform data".
      The table that is created has the same structure each time, but with a different number of rows. I'm wondering if it has to do with it being a POST, instead of a GET. However, the API requires a POST.

      • lbendlin's avatar
        lbendlin
        Super User

        Your code sample seems to indicate a dynamic composition of column headers.