API connection via ipv6 vs. ipv4

Hi all,

I have a problem with accessing the API in a timely manner. I’m accessing the following URL:

I’ve created an API key and a user and all seems good so far.

When I test it from Postman with the proper credentials it returns immediately with data as I would expect.

The problem comes in when I try to access it from someplace besides Postman…like my code. It takes MINUTES to return, but it does eventually return with data.

Same problem from a terminal with this:

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'Api-Key: correct-api-key-here' \
  --header 'Api-Username: <correct user name here>' \
   'https://community.tenxguitar.com/c/7.json'

Same behavior as my python code. I don’t believe I have any configuration settings that would affect this (on the forum). Can anyone please advise or help me?

Thanks!

1 Like

Is Postman, and your example command-line code, both being run from the same machine?

Tried curl for a third comparison, rather than wget?

3 Likes

Does it return the results immediately if you add the -4 option to wget?

If not, can you post the (redacted) output if you add the -v option?

5 Likes

Yes, it’s on the same machine.

Michael,

I tried the -4 option (which I’m unfamiliar with) and it worked immediately and as expected. I then tried the -v option and if I read correctly, it looks like an SSL timeout. Here’s the -v output. Can you elaborate on the -4 option? Thanks! Note I had to cut some stuff out due to posting restrictions on links.

Resolving community.tenxguitar.com (community.tenxguitar.com)… 2001:470:1:59e::139, 66.220.12.139
Connecting to
()|2001:470:1:59e::139|:443… failed: Connection timed out.
Connecting to ()|66.220.12.139|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/json]
Saving to: ‘7.json.4’

1 Like

Your machine currently has both IPv4 and IPv6 address configured, but your IPv6 connectivity is broken and connection attempts via IPv6 time out.

wget (and probably your Python code) is trying IPv6 first, timing out, then connecting successfully over IPv4. But it works when -4 forces the use of IPv4.

postman is likely either only using IPv4, or it is trying both IPv4 and IPv6 at the same time and using whichever connects first.

You’ll need to investigate why IPv6 connections don’t work on your network. Even if they fail immediately, that’s better since wget will know to immediately try via IPv4 rather than wait for IPv6.

(or, force your connections to IPv4-only)

9 Likes

Thank you sir! That is interesting. I’ll look into it. Thanks again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.