API (curl) Team for approving an advanced build Jobs in Jenkins

Is there a way that an approver can approve a specific assembly using the curl command?

I am using the Promoted Builds plugin for manual approval for assembly.

when I try to execute the curl command, it gives "Error 400 nothing is sent." I searched everywhere, but could not get the correct answer. Please, help

curl http: // admin: XXXXXXXXXXXX @ JENKINS _URL / job / JOB_NAME / 129 / promotion / promotionProcess / PromoteForTesting / promotionCondition / hudson.plugins.promoted_builds.conditions.ManualCondition / approve? token = abcde1234

When I tried to pass JSON data, it throws "Error 403". Not a single crumb was included in the request.

curl command http: // admin: XXXXXXXXXXXX @ JENKINS _URL / job / JOB_NAME / 129 / promotion / promotionProcess / PromoteForTesting / promotionCondition / hudson.plugins.promoted_builds.conditions.ManualCondition / approve? token = abcde1234 - json- urcode {& Submit = Approve} '

Have I followed API support for manually approving promoted collections in Jenkins? as a reference but no luck

+1
source share
1 answer

, , ... , . , Json Values, , , , . -, CSRF, HTTP- . , , - JSON . . , CURL. , URL . / JSON DATA .

: , stackoverflow. Filed ".crumb", "Jenkins-Crumb"

curl -v -H "Jenkins-Crumb: XXXXXXXXXXX" -X POST http://USER:TOKEN@JENKINS_URL/job/JOB_NAME/JOB_NUMBER/promotion/promotionProcess/PromoteForTesting/promotionCondition/hudson.plugins.promoted_builds.conditions.ManualCondition/approve --data-urlencode json = '{ "": [{ "_ ": "hudson.model.StringParameterValue", "": "", "": "}, {" _ ":" hudson.model.StringParameterValue", "": "", "": "Deploy (ZettaDevelopment) "}, {" _ ":" hudson.model.StringParameterValue", "": "BuildSelection", "": "" }, { "_ ":" hudson.model.StringParameterValue "," ":" Parameter", "": "Parameter"}]} '

http://USER:TOKEN@JENKINS_URL/job/JOB_NAME/JOB_NUMBER/promotion/promotionProcess/PromoteForTesting/promotionBuild/Build_NUMBER/api/json

Build_NUMBER - , . .

, , : -)

+1

All Articles