I have a client in Keycloak with more than 100 resources. And I am trying to query the id of a resource with the Keycloak Admin REST API the following way:
RESOURCE_ID=$(curl -k -s -H "Authorization: bearer $ACCESS_TOKEN" "$KEYCLOAK_URL/auth/admin/realms/$REALM/clients/$CLIENT_ID/authz/resource-server/resource" | jq -r '.[] | select(.name=="xy resource")._id')
Unfortunatelly "xy resource" is at the end of the alphabetically ordered list and the curl gives back only th first 100 resource objects.
Is there a way to query more than 100 records with the Keycloak Admin REST API or query directly the one with the given name?
I use Keycloak 12.0.4.
I have a client in Keycloak with more than 100 resources. And I am trying to query the id of a resource with the Keycloak Admin REST API
Go get more than 100 resources, you just need to set the max parameter to -1 for example:
https://{KEYCLOACK_URL}/admin/realms/{MY_REALM}/users?max=-1
Please check REST API documentation, there are a lot of Query optional parameter 'max'
Maximum results size (defaults to 100) integer(int32)
https://www.keycloak.org/docs-api/7.0/rest-api/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With