我首先发送的那个参数就是被利用的那个。其余的将被忽略。如果您查看下面的分页信息,您将看到如何播放。为什么gitlab api V4仅尊重第一个参数,而忽略其余参数?
$ curl --head --header "PRIVATE-TOKEN: asdfasdf" https://gitlab.asdfasdf.com/api/v4/projects/?per_page=100&page=2
RESPONSE HEADERS
x-next-page: 2
x-page: 1
x-per-page: 100
x-prev-page:
x-total: 172
x-total-pages: 2
$ curl --head --header "PRIVATE-TOKEN: asdfasdf" https://gitlab.asdfasdf.com/api/v4/projects/?per_page=50&page=2
RESPONSE HEADERS
x-next-page: 2
x-page: 1
x-per-page: 50
x-prev-page:
x-total: 172
x-total-pages: 4
$ curl --head --header "PRIVATE-TOKEN: asdfasdf" https://gitlab.asdfasdf.com/api/v4/projects?page=2
RESPONSE HEADERS
x-next-page: 3
x-page: 2
x-per-page: 20
x-prev-page: 1
x-total: 172
x-total-pages: 9
答案 0 :(得分:2)
您需要将URL括在引号"
中,因为问号?
被视为通配符,否则,根据您的shell,与号&
会将命令发送到后台。 / p>
curl --head --header "PRIVATE-TOKEN: asdfasdf" "https://gitlab.asdfasdf.com/api/v4/projects?page=2"
RESPONSE HEADERS
…
X-Page: 2
…