REST API Endpoints

GET http://localhost:8080/rest/jenkins-utils/1.0/utility/jenkins/job/build/status

Required Query Parameters:

  • configId
  • jobURL
  • buildType

POST http://localhost:8080/rest/jenkins-utils/1.0/utility/jenkins/job/build/run

Required Data Fields:

  • configId
  • jobURL
  • jobParams

GET http://localhost:8080/rest/jenkins-utils/1.0/utility/jenkins/job/build/context

Required Query Parameters:

  • configId
  • jobURL
  • limit


GET http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/servers

$ curl -u superadmin -XGET "http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/servers"
[{"id":1,"jenkinsName":"Jenkins Team","jenkinsUrl":"http://jenkins-team","jenkinsUser":"admin",\
"jenkinsToken":"****","lastAuthor":"superadmin","lastUpdated":1596862568281,"csrfCrumbIssue":true,\
"ignoreSslCert":true},{"id":3,"jenkinsName":"Jenkins Team x55","jenkinsUrl":"http://jenkins-server-x55",\
"jenkinsUser":"prasadve","jenkinsToken":"xxxxx","lastAuthor":"superadmin",\
"lastUpdated":1596862545578,"csrfCrumbIssue":true,"ignoreSslCert":true}]
$

GET http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/servers/?id=1

DELETE http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/servers/?id=1

POST http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/server

$ curl -u superadmin -XPOST "http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/server" \
-H "Content-Type: application/json" --data '{"jenkinsName":"Master x1","jenkinsUrl":"http://master-x1:8080",\
"jenkinsUser":"admin","jenkinsToken":"nsdiw9efn","csrfCrumbIssue":true,"ignoreSslCert":true}'
{"status":6,"message":"Updated configuration."}
$

GET http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/jobs/?projectKey=DT

$ curl -u superadmin -XGET "http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/jobs/?projectKey=DT
[{"id":28,"configId":1,"projectId":10201,"jobUrl":"http://jenkins-master1/job/Hello%20World","scanCount":100},\
{"id":29,"configId":1,"projectId":10201,"jobUrl":"http://jenkins-master1/job/Software-Engineering/job/Golden-Tree-WebApp/",\
"scanCount":100
$

DELETE http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/job/?id=1

POST http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/job/?projectKey=DT

$ curl -u admin -XPOST "http://localhost:8080/rest/jenkins-utils/1.0/form/jenkins/job/?projectKey=DT" \
--data '{"configId":2,"jobUrl":"http://localhost:8080","scanCount":1000}' \
-H "Content-Type: application/json"
{"status":34,"message":"Added Job ID [34]"}
$