Forum Discussion

WillianSousa's avatar
WillianSousa
Regular Visitor
3 years ago

API - GET Request - Timing out when setting Anonymous credentials

Good day.

I have been facing issues with APIs that belong to the company where I work. I need to access those to embed them in a project. 

a) Tested in Postman and it runs okay.

b) Issue Step-by-Step:

            1) After writing the below code in a blank query,
             2) PQ credentials screen pops up.
             3) Then I set an Anonymous credential and click "Okay".
             4) It shows "waiting for api.maersk.com" and after ~8min it times out.
c) Same behaviour is delivered by APIs that belongs to other branch of the company. "https://api.apmterminals.com"

May someone help to clarify what might be the issue? If it is related to the host url, with that I can reach out to developers in the company and simulate other scenarios. So far, I have no clue to explain what might occur when I set Anonymous Request and timeout.

**I tried through the ApiKeyName option, but it gets the same result.
**Also I tried many other adjustments in the code, but the same result is delivered.

let
MaerskDeadline =
Web.Contents("https://api.maersk.com",
[
Headers = [#"Consumer-Key" = "dummyconsumerkey"],
RelativePath = "shipment-deadlines",
Query =
[
ISOCountryCode = "AR",
portOfLoad = "SAN ANTONIO ESTE",
vesselIMONumber = Text.From(9825403), //9825403),
voyage = "313W"
],
]
)
)
in
MaerskDeadline

 

5 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi WillianSousa 

     

    How much time would Postman run to get the response from the same API? If it also runs several minutes, you can try adding the Timeout property to Web.Contents() function to set a longer timeout value. Web.Contents - PowerQuery M

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

    • WillianSousa's avatar
      WillianSousa
      Regular Visitor

      Hi v-jingzhang 

       

      thanks your collaboration. It runs really fast in Postman, less than 2 seconds to retrieve the response.

       

      I have added 10min of Timeout but it gets the same result.

       

      It seems to be an issue with the root url, but I need to understand what must be changed in the API, since I have no clue of what is happening under the hood 

      • v-jingzhang's avatar
        v-jingzhang
        Community Support

        Hi WillianSousa 

         

        Can you generate the cURL code of the request from Postman and share it here after removing sensitive information?

         

        Best regards,

        Jing