Can't import realm via REST-API @ KC 17.0.0

Dear community,

i’m trying to import a realm-export via REST-api like show in https://www.lisenet.com/2020/create-a-keycloak-realm-using-admin-rest-api/.

I’m getting the token, all’s fine, but when importing i’m hitting a “http-500” with a following stacktrace:

The instance runs the “quay.io/keycloak/keycloak:17.0.0” image in a v1.19 kubernetes cluster
behind a TLS-terminating proxy.

POD onfiguration environment variables are:

CONFIG_ARGS: start-dev
IMPORT_FORCE: true
IMPORT_MANAGED_ROLE: no-delete
IMPORT_STATE: false
JAVA_OPTS_APPEND: -Xms1024m -Xmx2048m
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://pg-postgresql/keycloak
KC_DB_USERNAME: keycloak
KC_FEATURES: admin2,scripts,upload-scripts
KC_HOSTNAME: <…>
KC_HOSTNAME_STRICT: false
KC_HTTP_ENABLED: true
KC_LOG_LEVEL: INFO
KC_METRICS_ENABLED: true
KC_PROXY: edge
KEYCLOAK_ADMIN: admin
KC_DB_PASSWORD: <set to the key ‘KC_DB_PASSWORD’ in secret ‘keycloak-kc-db-password’> Optional: false
KEYCLOAK_ADMIN_PASSWORD: <set to the key ‘KEYCLOAK_ADMIN_PASSWORD’ in secret ‘keycloak-keycloak-admin-password’> Optional: false

I can login into Web-UI do everything needed, all works fine.

The realm-export was created using the Web-UI too.

If i modify the export (e.g. changing the realm_id) i can successfully import it using the Web-UI.

But the REST-api import fails.

Any ideas?

Thanks in advance!

ok, i found the issue :slight_smile:

i tried to reference a non-existing realm file due to a typo in the import-script.
Thus, curl has always sent an empty data-“body”.