I am able to trigger the job but for some reason file is not getting uploaded to the jenkins workspace. If I try that manually from jenkins job runs fine. I have tried below-
1 )
RestAssured.given()
.auth().basic("USERNAME", "PASSWORD")
//.contentType(ContentType.URLENC)
.when()
.post("https://JENKINS_HOST/hudson/job/RISTSA/job/JOB_NAME/buildWithParameters" + "?file=C:/PATH_TO_FILE/SOMETHING.json&JenkinsStringParamName=test")
.then()
.statusCode(201);
2 )
RestAssured.given().log().all()
.contentType(ContentType.URLENC)
.auth().basic("USERNAME", "PASSWORD")
//.headers(httpHeaders("USERNAME", "PASSWORD"))
.formParam("file0", "C:/PATH_TO_FILE/SOMETHING.json")
.formParam("json", "{\"parameter\":[{\"name\":\"JenkinsFileParamName\",\"file\":\"file0\"},{\"name\":\JenkinsStringParamName\",\"value\":\"test\"}]}")
.when()
.post("https://JENKINS_HOST/hudson/job/RISTSA/job/JOB_NAME/buildWithParameters")
.then()
.statusCode(201);
I have tried to write this code from the official url which has a curl reference on jenkins docs
Any help is appreciated.