Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] get entities with rest api limited to 100 entities? #395

Closed
1 task done
Kat-CeDe opened this issue Jul 18, 2024 · 7 comments
Closed
1 task done

[bug] get entities with rest api limited to 100 entities? #395

Kat-CeDe opened this issue Jul 18, 2024 · 7 comments
Labels
invalid This doesn't seem right

Comments

@Kat-CeDe
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

I have 126 entities but the rest api only allows to get 100. I tried pages from 1..200, 101..200 and 30..130 but always got an error.

With for instance the search option I can collect more if I know what is missing.

How to Reproduce

  1. Create a lot of entities (at least more than 100)
  2. Try to retrieve entities with rest api

I can attache a backup with 126 (?) entities if needed

Expected behavior

Also entity pages >100 (99?) can be trieved.

System version

1.8.0

What part of the system affected by the problem?

Core

Additional context

No response

@Kat-CeDe Kat-CeDe added the bug Something isn't working label Jul 18, 2024
@github-project-automation github-project-automation bot moved this to Reported in Bug reports Jul 18, 2024
@github-actions github-actions bot added the core Core related issue label Jul 18, 2024
@martonborzak
Copy link
Contributor

Please provide the command you send and logs of the error.

@Kat-CeDe
Copy link
Author

Command is:
curl_setopt($ch, CURLOPT_URL, 'http://'.$IP2.'/api/entities?page=1&limit=130');
which is PHP up to limit=100 it is working. The Try option in the WebUI checks and says only 100 allowed.

The answer is:
array(3) {
["code"]=>
string(16) "VALIDATION_ERROR"
["message"]=>
string(30) "limit: Invalid per_page number"
["errors"]=>
array(1) {
[0]=>
array(2) {
["field"]=>
string(5) "limit"
["field_errors"]=>
array(1) {
[0]=>
array(3) {
["code"]=>
string(5) "RANGE"
["message"]=>
string(23) "Invalid per_page number"
["params"]=>
array(2) {
["max"]=>
float(100)
["min"]=>
float(1)
}
}
}
}
}
}

In the debug log of core I only get the same:
2024-07-18 10:54:45.133412 +00:00 core WARN Error encountered while processing the incoming HTTP request: ValidationErrorDetailed(ValidationErrorMsg { code: "VALIDATION_ERROR", message: "limit: Invalid per_page number", errors: Some([ValidationErrorDetail { field: "limit", field_errors: Some([FieldValidationError { code: Some("RANGE"), message: "Invalid per_page number", params: Some({"max": Number(100.0), "min": Number(1.0)}) }]) }]) })

Is there a way to retrieve entities over 100 with knowing a query word or an ID?

Ralf

@martonborzak martonborzak added invalid This doesn't seem right and removed bug Something isn't working core Core related issue labels Jul 18, 2024
@martonborzak
Copy link
Contributor

Paging works and it's documented in the docs. You can query 100 items per page. If you want to get the next page, you need to increase the page number and not the limit.

@github-project-automation github-project-automation bot moved this from Reported to Done in Bug reports Jul 18, 2024
@Kat-CeDe
Copy link
Author

Kat-CeDe commented Jul 18, 2024

When I use:
curl -X 'GET'
'http://IP:PORT/api/entities?page=80&limit=50'
-H 'accept: application/json'

I get an empty array as an answer:
[]

@martonborzak
Copy link
Contributor

Let's say you have 230 entities.
Then you get the first 100 by calling: api/entities?page=1&limit=100
Then the next 100: api/entities?page=2&limit=100
Then you get the remaining 30 by getting the 3rd page: api/entities?page=3&limit=100

This is pretty much standard paging, nothing special here.

@Kat-CeDe
Copy link
Author

Thank you I thought with page was item number meant. Reading helps sometimes. A little excuse as you I am not native speaking.

@martonborzak
Copy link
Contributor

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
Status: Done
Development

No branches or pull requests

2 participants