Project

General

Profile

Actions

Bug #31897

open

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

Added by Daniel Kraemer over 3 years ago. Updated over 1 year 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 #1

Updated by Daniel Kraemer over 3 years ago

  • Subject changed from Headline api feature per_page=all doen't work as expected to Headline api feature per_page=all doesn't work for all ressources
Actions #2

Updated by Ewoud Kohl van Wijngaarden almost 3 years ago

Actions #3

Updated by Ewoud Kohl van Wijngaarden almost 3 years ago

  • Category set to API
Actions #4

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Related to Bug #35591: Can't use 'search' with fact_value via API added
Actions #5

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Subject changed from Headline api feature per_page=all doesn't work for all ressources to Headline api feature per_page=all doesn't work for all resources
Actions

Also available in: Atom PDF