Forum Discussion

sbenzaquen's avatar
sbenzaquen
Helper I
5 years ago

Connecting Harvest API with PowerBI

Hi,

 

I'm trying to connect Harvest and a PowerBI dashboard through an API. I managed to connect the data through a web connection and pass the credentials stage,  however, only 100 rows/1 page of data is retrieved when actually the specified period covers multiple pages. How can I retrieve more pages?

 

I found a very relevant article that explains this issue thoroughly, but my relatively short PowerBI experience limits me to know how to apply it. Where are these functions entered? I'd highly appreciate if someone could walk me over this in more detail than the article.

 

https://datachant.com/2016/06/27/cursor-based-pagination-power-query/

 

Thank you,

Salvador

7 Replies

    • sbenzaquen's avatar
      sbenzaquen
      Helper I

      Thank you mahoneypat . This is useful but when adding the custom column the following error gets prompt 

       

      Expression.Error: We cannot convert a value of type List to type Table.
      Details:
      Value=[List]
      Type=[Type]

       

      What can I do to fix it?

       

      Thanks,

      Salvador

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        Can you share your M code from the Advanced Editor and/or an example of what your data look like at the step before the error?

         

        Pat

  • Thank you both for this you saved me.  I want to share my code too if it is hopeful for anything--- which is nearly the same as the previous poster:

     

    BaseURL = "https://api.harvestapp.com/v2/projects?access_token=#######.pt.XXXXXXXXXXXXXXXXXX&account_id=######",
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i44FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = List.Numbers(0,10,100),
    #"Converted to Table" = Table.FromList(#"Changed Type", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Changed Type1" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each Json.Document(Web.Contents((BaseURL&"limit=100"&[Column1]))))

  • sanderallert's avatar
    sanderallert
    Regular Visitor

    There's an App on the AppSource that allows you to connect to your Harvest data from Power BI. Here's the link: Harvest Reporting

    This may be a good example to get started?