Operations 3 min read

Jenkins API Endpoints and Using httpRequest in a Pipeline

This guide lists Jenkins REST API endpoints for project management tasks such as retrieving information, creating, disabling, enabling, deleting, and building jobs, and demonstrates how to wrap HTTP requests with the httpRequest step in a Jenkins pipeline using authentication tokens.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Jenkins API Endpoints and Using httpRequest in a Pipeline

Provides the base URL of the Jenkins API (http://127.0.0.1:8080/api/) and enumerates REST endpoints for project operations, including retrieving project information, build details, configuration files, creating projects, disabling/enabling jobs, deleting projects, triggering builds, and parameterized builds, using HTTP GET or POST methods.

Explains the need for a GitHub authentication token when local integration is enabled, shows how to create credentials to store Jenkins account credentials, and demonstrates wrapping HTTP requests in a Jenkins pipeline with the httpRequest step.

pipeline { agent { node { label "master" } } stages { stage("test") { steps { script { httpRequest authentication: 'jenkins-zeyang-admin', httpMode: 'POST', responseHandle: 'NONE', url: 'http://192.168.1.200:30080/job/test/disable' } } } } }

Includes screenshots illustrating the token value, credential creation UI, and verification results after executing the pipeline step.

CI/CDDevOpsAPIpipelineJenkinshttpRequest
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.