How to list more than 100 Quay repositories using next_page token
Environment
- Red Hat Quay
- 3.6
Issue
- curl command can't list more than 100 Quay repositories
Resolution
-
next_page token to be used. Get the next_page token. The following curl command will produce the first 100 records and the token for the next page. Use this next_page token for the second curl command
#curl -X GET --header "Authorization: Bearer ${TOKEN}" "https://${URL}/api/v1/repository?namespace=${ORGANIZATION}" - example #curl -X GET -H "Authorization: Bearer NgBesagLrC3s3KpH" "https://quay.example.com/api/v1/repository?namespace=redhat" | jq '.' | head -20 100 15092 100 15092 0 0 49320 0 --:--:-- --:--:-- --:--:-- 49159 { "repositories": [ { "namespace": "redhat", "name": "repo1", "description": "description", "is_public": true, "kind": "image", "state": "NORMAL", "is_starred": false }, { "namespace": "redhat", "name": "repo2", "description": "description", "is_public": true, "kind": "image", "state": "NORMAL", "is_starred": false }, ... gAAAAABhC5BunFXqUYIni1MZ_eXO8NL_TQEVzPEwpcUlnTMChM0YaNBiZwApkIllW5hpg8ARSBsuFg== <---- next_page token -
Use next_page token from the previous command and list more than 100 repositories
$ curl -X GET -H "Authorization: Bearer Dz7hPQ..." "http://quay.example.com/api/v1/repository?namespace=redhat&next_page=gAAAAABhC7A...SBsuFg== " | jq '.' | head -20 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 15200 100 15200 0 0 51351 0 --:--:-- --:--:-- --:--:-- 51351 { "repositories": [ { "namespace": "redhat", "name": "repo101", "description": "description", "is_public": true, "kind": "image", "state": "NORMAL", "is_starred": false }, { "namespace": "redhat", "name": "repo102", "description": "description", "is_public": true, "kind": "image", "state": "NORMAL", "is_starred": false },
Root Cause
- Each page requires unique pagination token
SBR
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.