Sending Organisation invitation via API

128 views
Skip to first unread message

Peter Dormehl

unread,
Jul 13, 2024, 8:23:14 AM7/13/24
to Keycloak User
Hello all,

I am attempting to send an invitation via the organization members invite. I am getting back a StatusCode: 400, ReasonPhrase: 'Bad Request'

I am posting a JSON structured as below:
{"email":"exa...@example.net","firstName":"ex","lastName":"ample"}

I am posting this to 

Could you please let me know if this is the correct post url. or what I am posting incorrectly as I am following from:

    @Path("invite-user")
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    @Tag(name = KeycloakOpenAPI.Admin.Tags.ORGANIZATIONS)
    @Operation(summary = "Invites an existing user or sends a registration link to a new user, based on the provided e-mail address.",
            description = "If the user with the given e-mail address exists, it sends an invitation link, otherwise it sends a registration link.")
    public Response inviteUser(@FormParam("email") String email,
                               @FormParam("firstName") String firstName,
                               @FormParam("lastName") String lastName) {
        return new OrganizationInvitationResource(session, organization, adminEvent).inviteUser(email, firstName, lastName);
    }

Thanks

Alexander Schwartz

unread,
Jul 15, 2024, 2:38:55 AM7/15/24
to Peter Dormehl, Keycloak User
Hi Peter,

it seems that the resource you want to use asks for content to be form-url-encoded, where you send JSON content. 

Best,
Alexander

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/6b7a88a7-730e-4ef0-be3b-1db6c6db906an%40googlegroups.com.


--

Alexander Schwartz, RHCE

He/Him

Principal Software Engineer, Keycloak Maintainer

Red Hat - Germany remote

asch...@redhat.com   

Red Hat GmbH, Registered seat: Werner von Siemens Ring 12, D-85630 Grasbrunn, Germany 
Commercial register: Amtsgericht Muenchen/Munich, HRB 153243,
Managing Directors: Ryan Barnhart, Charles Cachera, Michael O'Neill, Amy Ross

Peter Dormehl

unread,
Jul 15, 2024, 12:40:46 PM7/15/24
to Keycloak User
Hi thanks for this, I didnt look at it correctly.

Thanks again

Reply all
Reply to author
Forward
0 new messages