MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to Login to Jenkins using commands and API?

Working commands for Login


# Method 1 - Login to Jenkins using CLI and Username and Password
$ java -jar jenkins-cli.jar -s http://13.235.81.87:8080/ -auth rajesh:1190c7e6cb8e3b65515f8495966814ad58 who-am-i
$ java -jar jenkins-cli.jar -s http://13.235.81.87:8080/ -auth rajesh:1190c7e6cb8e3b65515f8495966814ad58 delete-job testCode language: PHP (php)

##Command to know the status of Build?

$ curl http://myjenkins/job/myjob/lastBuild/api/json | grep --color result\":null
$ echo $?Code language: PHP (php)

##Trigger a Jenkins Job without authentication

$ wget http://yourserver/job/MyJobname/build?delay=0sec
$ wget -O - $HUDSON_URL/job/JOBNAME/build
$ curl http://jenkins:8080/job/my%20job/buildCode language: PHP (php)


##Trigger a Jenkins Job with authentication

$ curl --user dbacher:$MY_API_TOKEN http://jenkins:8080/job/my%20job/build
$ curl --user <your_jenkins_username>:<your_jenkins_API_key>http://<jenkins_server_url>/job/<your_jenkins_job_name>/buildCode language: HTML, XML (xml)

##Running commands against a secure Jenkins (basic auth or ssh keys)

$ java -jar jenkins-cli.jar -s http://myjenkins help --username me --password mypassword
$ java -jar jenkins-cli.jar -s http://myjenkins help -i ~/.ssh/id_rsaCode language: JavaScript (javascript)

##Triggering a job build against a secure Jenkins (avoiding a 1.5 year old open bug!)

$ java -jar jenkins-cli.jar -s http://myjenkins build 'My Awesome Jenkins Job' -i ~/.ssh/id_rsa
$ java -jar jenkins-cli.jar -s http://myjenkins build 'My Awesome Jenkins Job' -i ~/.ssh/id_rsa -s -vCode language: JavaScript (javascript)

##Passing parameters when triggering a job build

$ java -jar jenkins-cli.jar -s http://myjenkins build 'Deploy XYZ App' -i ~/.ssh/id_rsa -s -v -p target_env=api.cloudfoundry.com -p branch=masterCode language: JavaScript (javascript)

How to get your_jenkins_API_key?

  • Login to your Jenkins.
  • Click on the username in the top right.
  • Click on Configure.
  • Click on โ€˜Show API Tokenโ€™ button.
  • You got it.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Jenkins X Tutorials: Install and Configurations

This page covers a local Jenkins X v3 lab: a single-node k3s cluster with HashiCorp Vault for secrets, followed by the Jenkins X git operator. The commands…

Read More

Automating Jenkins Job Configuration: Job DSL, Multibranch, Job Generator, and JJB

Manually creating many Jenkins jobs is slow and error-prone. This guide compares the main automation options and shows practical jobs-as-code examples for repeatable setup.

Read More

Install Jenkins with Docker: Persistent Setup, Port Mapping, and Logs

Learn how to run Jenkins in Docker with correct port mapping, persistent storage, and operational commands. This updated guide keeps the original workflow but adds modern, production-minded practices.

Read More

Jenkins at Scale: Practical References and Admin Cheatsheet

This revised guide upgrades a short 2015 Jenkins link post into an operations-ready reference for teams running Jenkins at scale. It preserves the original links and adds a workflow diagram, comparison table, and practical API/CLI examples.

Read More

Jenkins Email-ext: Add Full or Regex-Filtered Build Logs to Email Body

Learn how to include Jenkins build logs directly in notification emails using email-ext tokens. This revised guide covers full-log and regex-filtered approaches for freestyle jobs and Pipeline templates.

Read More

Jenkins Backup and Restore Runbook: ThinBackup, Filesystem Archives, and Recovery Steps

A practical Jenkins backup and restore guide for DevOps teams, covering what to back up, strategy trade-offs, and step-by-step command examples. Includes a workflow diagram and a recovery checklist you can operationalize.

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x