Forum Discussion

emerson89's avatar
emerson89
Helper I
6 years ago

Error AccessForbinddenException to Refresh data

Hi,

 

I use a query by calling another query, via API and I'm not able to update the data in Power BI.

In Power Query it works normally, but for that, so that in Power Query I could run the "query from the query" I had to make the following changes to my project:

 

1 - Clear the Global Permissions and local permissions in Datasource configuration.

2 - Datasource Configuration >> Edit Permissions: I changed to privacy level: none and Credencials: none

3 - In the menu Options >> Privacy, I checked the item: "always ignore privacy level settings"

 

Changing the items above, in Power Query, my query works correctly. However, when trying to Apply these changes to the Panel, I get the following error message:

 

 

- My query lists about 30 thousand rows, and I noticed that if I limit my query to half the data, it works normally without the above error, in the dashboard panel, updating the data correctly.
My question is whether there are any data limit limitations for loading on the panel? And if so, how can I solve this problem?
If it is not a limitation of lines in loading, what could be happening so that my panel is not updated?

 

My Query:

let
    ufnCallAPI = (numPedido) =>

        let
            result = Json.Document(Web.Contents("https://api.vhsys.com/", [RelativePath="v2/pedidos/" & Number.ToText(numPedido)  & "/produtos", 
             Headers=[#"access-token"="OCKNYbAMaDgLBZBSQPCOGPWOXGSbdO", #"secret-access-token"="xxxxxxxx"]]))  
        in
            result,

        pageRange = listaPedidos_Aquiles2, /* MY OTHER QUERY */
        pages = List.Transform(pageRange, each ufnCallAPI(_)),
    pages2 = Table.FromList(pages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    pages3 = Table.ExpandRecordColumn(pages2, "Column1", {"code", "status", "data"}, {"code", "status", "data"}),
    pages4 = Table.ExpandListColumn(pages3, "data"),
    pages5 = Table.RemoveColumns(pages4,{"code", "status"}),
    #"data Expandido" = Table.ExpandRecordColumn(pages5, "data", {"id_ped_produto", "id_pedido", "id_produto", "desc_produto", "qtde_produto", "desconto_produto", "ipi_produto", "icms_produto", "valor_unit_produto", "valor_custo_produto", "valor_total_produto", "valor_desconto", "peso_produto", "peso_liq_produto", "info_adicional", "xPed_produto", "nItem_produto"}, {"id_ped_produto", "id_pedido", "id_produto", "desc_produto", "qtde_produto", "desconto_produto", "ipi_produto", "icms_produto", "valor_unit_produto", "valor_custo_produto", "valor_total_produto", "valor_desconto", "peso_produto", "peso_liq_produto", "info_adicional", "xPed_produto", "nItem_produto"}),
    #"Personalização Adicionada" = Table.AddColumn(#"data Expandido", "Empresa", each "Aquiles")
in
    #"Personalização Adicionada"

 

Thank you very much!

4 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi emerson89 ,

     

    Are you paginating it ? Try running it with 1 or 2 pages, just to check if you get this error.

    • emerson89's avatar
      emerson89
      Helper I

      Hi camargos88 ,


      Yes, My query listaPedidosAquiles is paginate, but, alone, this work fine. I tested it by dividing the page quantity in half, and it worked fine. I tested it on 4 pages too, for example, and everything works normally. The problem occurs when I try to list all data. Any idea?

      Thanks

       

      • camargos88's avatar
        camargos88
        Community Champion

        emerson89 ,

         

        I suspect the code tries to get more pages than the amount available.

        How are you defining the amount of pages ?