
Jenkins Has a Free API: Here's How to Use It for CI/CD Automation
Jenkins REST API is one of the most overlooked features of the most popular CI/CD server. You can trigger builds, check status, manage plugins, create jobs, and build custom dashboards — all via simple HTTP calls. Why Use the Jenkins API? Trigger builds from Slack, GitHub webhooks, or custom tools Monitor build health across all pipelines Automate job creation and configuration Build custom CI/CD dashboards Getting Started export JENKINS_URL = "http://localhost:8080" export JENKINS_USER = "admin" export JENKINS_TOKEN = "your-api-token" # Get Jenkins info curl -s -u " $JENKINS_USER : $JENKINS_TOKEN " " $JENKINS_URL /api/json" | jq '{mode: .mode, numExecutors: .numExecutors, jobs: [.jobs[] | {name: .name, color: .color}]}' # Trigger a build curl -s -u " $JENKINS_USER : $JENKINS_TOKEN " -X POST " $JENKINS_URL /job/my-project/build" # Trigger with parameters curl -s -u " $JENKINS_USER : $JENKINS_TOKEN " -X POST " $JENKINS_URL /job/deploy/buildWithParameters?ENVIRONMENT=staging&VERSION=2.1.
Continue reading on Dev.to
Opens in a new tab



