Portfolio API and Power Query

The Asani API notes the shell for getting all portfolios in a workspace as the following:

curl --request GET
–url ‘https://app.asana.com/api/1.0/portfolios?workspace=&owner=’
–header ‘accept: application/json’
–header ‘authorization: Bearer xxxxxxxxxxxxxxxxxxxxx’

This works fine on the website as well when doing the test and inputting the correct string IDs.

I’m trying to recreate this request in PowerBI but I can’t seem to get it working correctly. I’m guessing it’s my syntax as I’m not an experienced power query guy, but I have been able to pull projects, tasks, users with no issues.

I’m trying to use the following PQ formula (I’m guessing this is not formatted right)
Json.Document(Web.Contents(“https://app.asana.com/api/1.0/portfolios?workspace=“&[workspaceid]&“owner=”&[ownerid]&””, [Headers=[Accept=“application/json”, authorization=“Bearer xxxxxxx”]]))

Error: Expression.Error: The ‘authorization’ header is only supported when connecting anonymously. These headers can be used with all authentication types: Accept, Accept-Charset, Accept-Encoding, Accept-Language, Cache-Control, Content-Type, If-Modified-Since, Prefer, Range, Referer

You can use this code:

let
    Source = Web.Contents("https://app.asana.com/api/1.0/portfolios?limit=100&workspace=XXXXX&owner=XXXXX", 
        [Headers=[Authorization="Bearer XXXXXXXXX"]])
in
    Source

You have to add the workspace guid, the owner of the portfolio and your token.

Let me know if you have any questions!