when I tried to make a simple call to jenkins trying to achieve any correct response, no matter how I set the configurations according to doc, error 403 will always be the response.
here is the testing code:
public class UtilTest {
static final String JENKINS_URL = "http://192.168.2.200:9090/jenkins/";
static final String JENKINS_USERNAME = "admin";
static final String JENKINS_PASSWORD = "123456789";
public static void main(String[] args) throws IOException {
JenkinsHttpClient client = new JenkinsHttpClient(URI.create(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD);
JenkinsServer server = new JenkinsServer(client);
//another try
// JenkinsServer server = new JenkinsServer(URI.create(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD);
//will return 403
JobWithDetails mytest = server.getJob("mytest");
List<Build> allBuilds = mytest.getAllBuilds();
//will return 404
// Map<String, Job> jobs = server.getJobs();
// System.out.println(JSON.toString(jobs));
}
}
Here is the jenkins location setting, the api location correctly work while requesting by postman.
I have tried several apis. they all failed with 404 or 403.
By tracking down to apache.http source code of those with 403 fall back, I found no Authorization params nor header nor body in the request.
It seems that some of the apis were not match Jenkins version, and also , authorization seems not working at all.
I'm using Jenkins 2.289.1
when I tried to make a simple call to jenkins trying to achieve any correct response, no matter how I set the configurations according to doc, error 403 will always be the response.
here is the testing code:
Here is the jenkins location setting, the api location correctly work while requesting by postman.
I have tried several apis. they all failed with 404 or 403.
By tracking down to apache.http source code of those with 403 fall back, I found no Authorization params nor header nor body in the request.
It seems that some of the apis were not match Jenkins version, and also , authorization seems not working at all.