Having issues with API requests when authenticating using a domain user

Article ID:360053178791
1 minute readKnowledge base

Issue

I’m trying to make an API call to my Jenkins instance using my domain user but it’s failing with:

curl: (7) Failed to connect to yourdomain.com port X: Connection timed out

It mainly affects users with a "@" character.

Resolution

This is caused by the "@" character, that makes the call interpret your user’s domain as the URL to reach.

It can be fixed by replacing your call, defining the user and token as an argument.

  • Example of a command that will fail

curl https://youruser@yourdomain.com:yourtoken@jenkins.yourdomain.com/api/json
  • Example of a successful command

curl -u youruser@yourdomain.com:yourtoken https://jenkins.yourdomain.com/api/json
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.