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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Rookie_2022
New Contributor III

API Power Query

Hello all,

 

I have used Postman to run a query wiht Consumer Key in Postman, it works and gives correct result.

 

But when I used the same parameters and Consumer-Key, and used below m query to get the result, the query has been loading long and timed out eventually. Anyone could help? Thanks.

 

Rookie_2022_1-1756456043380.png

 

Rookie_2022_2-1756456266204.png

 

 

1 ACCEPTED SOLUTION
v-agajavelly
Contributor III

Hey @Rookie_2022 ,

Thanks for sharing the updates. Since Postman works fine but Power Query is still timing out, it might be more of a connectivity or header handling issue inside Power BI. A couple of quick checks you could try:

  • Make sure "Consumer-Key" is quoted exactly in the headers.
  • Pass the query parameters under Query = [...] instead of as a separate record.
  • Try adding a longer timeout with Timeout = #duration(0,0,3,0).
  • If possible, test the same URL (with parameters) directly in a browser or using curl that will confirm whether the timeout only happens in Power Query.

Did you get a chance to try calling the API outside Postman (like in a browser)? That would help narrow down if the issue is with the API itself or just how Power Query is handling it.

Regards,
Akhil.

View solution in original post

9 REPLIES 9
Rookie_2022
New Contributor III

Hello all,

 

I have used Postman to run a query wiht Consumer Key in Postman, it works and gives correct result.

 

But when I used the same parameters and Consumer-Key, and used below m query to get the result, the query has been loading long and timed out eventually. Anyone could help? Thanks.

 

Rookie_2022_0-1756458579439.png

 

 

Rookie_2022_1-1756458579749.png

 

 

 

Hi @Rookie_2022,

 

Try restructuring your query like this:

 

let
url = "https://api.maersk.com/products/ocean-products",
response = Web.Contents(
url,
[
Query = [
vesselOperatorCarrierCode = "MAEU",
collectionOriginCountryCode = "US",
collectionOriginCityName = "Houston",
collectionOriginUnlocCode = "USHOU",
deliveryDestinationCountryCode = "NL",
deliveryDestinationCityName = "Rotterdam"
],
Headers = [
#"Content-Type" = "application/json",
#"Consumer-Key" = "your-key-here"
]
]
),
json = Json.Document(response)
in
json

 

Instead of query = "..." you should pass query params inside the Query option of Web.Contents.

Your header keys must be quoted correctly (e.g. #"Consumer-Key").

If the API requires POST, you’d need to use Content = Text.ToBinary(...) instead of Query. (But from your Postman screenshot, it looks like GET).

 

🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

 

 

Hi @grazitti_sapna 

 

The Method is GET. I just copied your code and replace the Consumer Key with my key. However it still timeout as below.

 

Rookie_2022_1-1756462169420.png

 

Your Power Query is timing out because it’s likely missing the "Method = "POST" declaration. Power Query defaults to GET unless told otherwise. Add this inside your Web.Contents call:
Method = "POST"


Also make sure:
- Headers are correctly formatted ("Content-Type" and "Consumer-Key")
- Body is converted with Text.ToBinary(Json.FromValue(body))
- You can optionally extend timeout with Timeout = #duration(0,0,3,0)

Shahed Shaikh

Hi @Shahid12523 

 

Method = GET.

 

Can you help advise if I should use other codes? Thanks.

v-agajavelly
Contributor III

Hey @Rookie_2022 ,

Thanks for sharing the updates. Since Postman works fine but Power Query is still timing out, it might be more of a connectivity or header handling issue inside Power BI. A couple of quick checks you could try:

  • Make sure "Consumer-Key" is quoted exactly in the headers.
  • Pass the query parameters under Query = [...] instead of as a separate record.
  • Try adding a longer timeout with Timeout = #duration(0,0,3,0).
  • If possible, test the same URL (with parameters) directly in a browser or using curl that will confirm whether the timeout only happens in Power Query.

Did you get a chance to try calling the API outside Postman (like in a browser)? That would help narrow down if the issue is with the API itself or just how Power Query is handling it.

Regards,
Akhil.

v-agajavelly
Contributor III

Hi @Rookie_2022 ,

Did you get a chance to try calling the API outside Postman like in a browser or with curl as suggested? That should help confirm whether the timeout is specific to Power Query or more on the API side.

Regards,
Akhil.

v-agajavelly
Contributor III

Hi @Rookie_2022 ,

Just checking back were you able to test the API outside of Postman (like in a browser or with curl) as suggested? Knowing the outcome there will really help narrow down if the timeout is on the Power Query side or with the API itself.

Regards,
Akhil.

v-agajavelly
Contributor III

Hi @Rookie_2022 ,

I hope the response provided helped in resolving the issue. If you still have any questions, please let us know we are happy to address.

Thanks,
Akhil.

Helpful resources

Announcements
Users online (11,084)