Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jdchipps
Frequent Visitor

API Key set in Web.contents

I have an API that now needs an API key for authentication.  I have been trying all morning to get this to work but do not know where in the below I need to set the API Key, can anyone help please as I need to get my report back online as soon as possible?

 

jsonDoc= Json.Document(
Web.Contents(
"https://**************/api/v1/***/****tory", [RelativePath="/?&start=" & Number.ToText(n)])),
result = jsonDoc[result],
records = result[records],
tmpTbl = Table.FromList(records, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

 

Thanks

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @jdchipps ,

 

You may try codes like below.

 

jsonDoc= Json.Document(

Web.Contents(

"https://**************/api/v1/***/****tory", [RelativePath="/?&start=" & Number.ToText(n)], [ApiKeyName="APIToken"]) ),

result = jsonDoc[result],

records = result[records],

tmpTbl = Table.FromList(records, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

 

 

For reference:

 

https://blog.crossjoin.co.uk/?s=web.contents&submit=Search

 

https://blog.crossjoin.co.uk/2014/03/26/working-with-web-services-in-power-query/

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Your relative path structure is slightly inaccurate.  But you can extend it as needed

 

jsonDoc= Json.Document(
Web.Contents(
"https://**************/api/v1/***/****tory", [RelativePath="/?APIKey=" & key & "&start=" & Number.ToText(n)])),

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.