Forum Discussion
Connect to an API with Power BI Desktop - Harvest
Hi Marki,
The Access Token should be added in the Http headers. Please try it as below. There is a wonderful example here. Since these headers aren't standard headers, please follow the example to add the code directly in the Advanced Editor.
let
apiUrl = "https://api.harvestapp.com/api/v2/users/me",
options = [Headers =[#"User-Agent"="Harvest API Example",#"Harvest-Account-ID"="8****8", #"Authorization"="Bearer 1***************Q"]],
result = Web.Contents(apiUrl , options)
in
result Note: Don't forget the blue bold part in the code.
Best Regards,
Dale
- markholland8 years ago
Helper I
Thanks v-jiascu-msft,
I was able to get access by removing one of the backslashes from the URL and choosing 'Anonymous' from the Web options, as the access token was already in the URL.
The new URL looks like this:
https://api.harvestapp.com/v2/time_entries?access_token=TOKENDETAILS&account_id=ACCOUNTID
I removed the backslash after 'time_entries' and removed 'COMPANYNAME' which gave me access to all my records.
Now I just need to figure out to how extract all pages from the API. Any thoughts?
Mark
- Anonymous8 years agoNot applicable
Im actually going through this same import right now too.
It looks like you can extract 100 time entries at a time (see pic). Have to figure out a way to get it extracting the rest of the pages if anyone has any ideas
- markholland8 years ago
Helper I
Hi Anonymous,
I was able to extract all pages. The only issue is it then removes the ability to schedule a refresh on the Service. So if you're only going to use it in Desktop, you'll be ok.
I followed this post. There's a comment by ImkeF that explains how it should appear in Advanced Editor:
https://community.powerbi.com/t5/Desktop/how-to-create-a-query-that-paginates/td-p/20047/page/3
I'm still stuck on how to get the Power BI to schedule a refresh when there's pagination in the coding.
Mark