【发布时间】:2019-05-14 16:27:52
【问题描述】:
我正在尝试使用 curl 访问 jenkins (v2.177) API。例如,我尝试按如下方式获取 lastbuild 编号:
curl -v -u user:pass http://myjenkins:port/job/myjob/lastBuild/api/json
为了给我一个 json,我得到一个“302 Found”,内容长度等于零! :
`* Trying 11.90.1.9...
* TCP_NODELAY set
* Connected to 11.90.1.9 (11.90.1.9) port 8484 (#0)
* Server auth using Basic with user 'user7'
> GET /job/myjob/lastBuild HTTP/1.1
> Host: 11.90.1.9:8484
> Authorization: Basic dGVzdGl.../blc2Y...
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Tue, 14 May 2019 13:01:12 GMT
< X-Content-Type-Options: nosniff
< Location: http://11.90.1.9:8484/job/myjob/
< Content-Length: 0
< Server: Jetty(9.4.z-SNAPSHOT)
<
* Connection #0 to host 11.90.1.9 left intact`
知道为什么我没有得到 JSON 吗?
【问题讨论】:
标签: jenkins curl jenkins-api