Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi, I'm trying to connect to our appstore account to retreive stats on app downloads.
The power query M code I've been trying is based on the API specification file downloadable from here and also I used took some guidance from the end of this article about JSON code here
...The M code I'm using at the moment is below, I'm getting an error message in Power Query saying 'Please specify how to connect [Edit credentials]'. Do I need to specify the connection this in the M code, if so I'm not sure how to do this?!... I'm new to using private key type APIs like this so hoping someone can advise where I'm going wrong please 🙏
let
Source =
Web.Contents(
"https://api.appstoreconnect.apple.com/",
[
RelativePath = "v1/salesReports",
Query=
[
key_id ="###ourkeyid###"
,issuer_id ="###ourissuerid###"
,key="-----BEGIN PRIVATE KEY-----\n###ourkey###\n-----END PRIVATE KEY-----"
//,duration= 1200, // optional (maximum 1200)
//,in_house= false // optional but may be required if using match/sigh,
]
]
)
in
Source
Solved! Go to Solution.
Hi @Anonymous ,
Given the nature of the error message you're receiving in Power Query, it appears that Power Query is prompting you to specify how to connect because it doesn't automatically recognize the authentication method required by the API you're trying to access. In cases involving APIs that require private key authentication, you typically need to handle the authentication process programmatically within your M code, which involves generating a token based on your private key and other credentials, and then passing this token as part of your API request headers.
However, the M code snippet you've shared seems to attempt to include the private key directly in the query parameters, which is not the standard method for APIs requiring private key authentication. Instead, you would generally need to:
1. Generate a JWT (JSON Web Token) using your private key and other necessary credentials.
2. Use this JWT to request an access token from the API's authentication endpoint.
3. Include the access token in the header of your API requests.
For a general understanding of handling API connections in Power Query M, you can refer to the documentation on Web.Contents function:
Web.Contents - PowerQuery M | Microsoft Learn
Web.Headers - PowerQuery M | Microsoft Learn
www.dalesandro.net
Here I have helped you find some of the correct ways to write it:
Solved: Connecting API - Microsoft Fabric Community
Solved: Connecting to API - Page 2 - Microsoft Fabric Community
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Given the nature of the error message you're receiving in Power Query, it appears that Power Query is prompting you to specify how to connect because it doesn't automatically recognize the authentication method required by the API you're trying to access. In cases involving APIs that require private key authentication, you typically need to handle the authentication process programmatically within your M code, which involves generating a token based on your private key and other credentials, and then passing this token as part of your API request headers.
However, the M code snippet you've shared seems to attempt to include the private key directly in the query parameters, which is not the standard method for APIs requiring private key authentication. Instead, you would generally need to:
1. Generate a JWT (JSON Web Token) using your private key and other necessary credentials.
2. Use this JWT to request an access token from the API's authentication endpoint.
3. Include the access token in the header of your API requests.
For a general understanding of handling API connections in Power Query M, you can refer to the documentation on Web.Contents function:
Web.Contents - PowerQuery M | Microsoft Learn
Web.Headers - PowerQuery M | Microsoft Learn
www.dalesandro.net
Here I have helped you find some of the correct ways to write it:
Solved: Connecting API - Microsoft Fabric Community
Solved: Connecting to API - Page 2 - Microsoft Fabric Community
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
14 | |
13 | |
12 | |
12 | |
12 |