doubletap
doubletap

Reputation: 32641

Gitlab api V4 only utilizing one of the parameters I am sending

Whichever parameter I send first is the one that is utilized. The rest are ignored. If you look at the paging information below, you will see how this plays out. Why does the gitlab api V4 only respect the first parameter and ignore the rest?

$ 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

Upvotes: 1

Views: 1097

Answers (1)

Sascha Frinken
Sascha Frinken

Reputation: 3356

You need to enclose the URL with quotes " as the question mark ? is treat as wildcard or the ampersand & will send the command to the background depending on your shell.

curl --head --header "PRIVATE-TOKEN: asdfasdf" "https://gitlab.asdfasdf.com/api/v4/projects?page=2"

RESPONSE HEADERS
…
X-Page: 2
…

Upvotes: 2

Related Questions