Keycloak API update multiple users at once

156 views Asked by At

I'm trying to find a more efficient way to update (enable/disable) a large list of users. Currently we use the following API endpoint, passing the user's keycloak id.

const userEnabled = formData.enabled ? 1 : 0;

awaitfetch(`${keycloakApiUrl}/admin/realms/myRealm/users/${user.keycloakId}`, {
    method: 'PUT',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        enabled: userEnabled,
    })
});

But what if I have a list of users that need to be disabled? Is there a more efficient way to disable/enable users without making a http request for each one? Please advise

0

There are 0 answers