Issue
-
Builds are not triggered through curl command and I receive an unauthentication message
-
Builds are not triggered and the job is inside a folder
Resolution
Builds are not triggered through curl command and I receive an unauthentication message
This issue usually happen because you didn’t use the escape character ""
For normal builds use:
curl -X POST https://<JENKINS_URL>/buildByToken/build?job=MY_JOB\&token=MY_TOKEN
For builds with parameters you need to use the structure below where Type is the parameter:
curl -X POST https://<JENKINS_URL>/buildByToken/buildWithParameters/build?job=MY_JOB\&token=MY_TOKEN\&Type=Mexican
Diagnostics
Changing the logging level to FINE helped identify the root cause.

Builds are not triggered and the job is inside a folder
As a job name you need to specify the Full Project Name you can get from Jenkins GUI.

So for exampe for the Job below which has as a token mytoken
https://felix.ci.cloudbees.com/job/myfolder/job/build-token-root-plugin-inside-folder/
The right command to trigger the job is:
curl -X POST https://felix.ci.cloudbees.com/buildByToken/build?job=myfolder/build-token-root-plugin-inside-folder\&token=mytoken
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.