Project

General

Profile

Actions

Bug #31897

open

Headline api feature per_page=all doesn't work for all resources

Added by Daniel Kraemer almost 4 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Wanted to use parameter per_page=all with /api/fact_values but dit not get any results.

❯ http --timeout 600  --json get "$FOREMAN_URL/api/fact_values" search="name = solute_apt_updates::available_updates::count" per_page=all | jq ".total, .per_page, .results|length" 
0
0
0
❯ http --timeout 600  --json get "$FOREMAN_URL/api/fact_values" search="name = solute_apt_updates::available_updates::count" per_page=10000 | jq ".total, .per_page, .results|length" 
0
10000
1014

Same with api/hosts thin=true

❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" thin=true per_page=all | jq ".total, .per_page, .results|length" 
0
0
0
❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" thin=true per_page=3000 | jq ".total, .per_page, .results|length" 
1055
3000
1055
❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" thin=true | jq ".total, .per_page, .results|length" 
1055
2000
1055

Since this was a headline feature of the 2.2.0 release and we just updated to 2.3.2. i was quite excited to use this.

Works fine without thin=true

❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" | jq ".total, .per_page, .results|length" 
1055
2000
1055
❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" per_page=all | jq ".total, .per_page, .results|length" 
1055
1055
1055
❯ http --timeout 600  --json get "$FOREMAN_URL/api/hosts" per_page=all search="name ~ dakr" | jq ".total, .per_page, .results|length" 
1055
1055
6

fyi http is the tool https://github.com/httpie/httpie

Ticket of feature: https://projects.theforeman.org/issues/29909


Related issues 2 (0 open2 closed)

Related to Foreman - Refactor #29909: Support fetching all records in APIClosedOndřej PražákActions
Related to Foreman - Bug #35591: Can't use 'search' with fact_value via APIDuplicateActions
Actions

Also available in: Atom PDF