Is there a way to change the attributes for a user programmatically using the okta sdk?

I need to update the Username user.login attribute to change the format restrictions to None and also add a new attribute of the format string array.

I have found out that there is a way from the UI, but I would like to do this from the code, using the okta java sdk or if that is not possible, then using the REST endpoint.

Is it possible? How would I go about it?


This blog post shows you how to use the Java SDK to get/set a custom attribute. Hope it helps!

Thanks Matt. That example shows how to get / set the values.

What I want to do is to define or change the properties of the User attributes.

Can I do that using the programmatic approach?


I don’t think you can define new attributes with the Java SDK. If you’d like to see this feature, please enter an issue for the project on GitHub.

Matt Raible

Thanks Matt. Created an issue on Project’s Gitbub

One other tip: You can call arbitrary API endpoints from the SDK that aren’t explicitly supported (yet). Check out this part of the docs:

To create a new user profile attribute, you’d model out the user profile custom subschema as documented here: and here:

I wrote a quick and dirty example of creating a new profile schema attribute here:

The crux of it is this code:

        ExtensibleResource result = client.http()
            .post("/api/v1/meta/schemas/user/default", ExtensibleResource.class);
1 Like

Thanks @micah.silverman for the example.

I presume for PUT / DELETE, the format may be similar to POST. Is it correct assumption?

One other question - When using the ExtensibleResource for GET, how do we define it such that we can pass either queryparameters or RequestBody and then retrieve the the returned JSON.

Is there any java example of how to define these?


Hi @mraible @micah.silverman, hope you can help me with a GET call.

I need help with the second parameter for the “get” call below. And also, how do we retrieve the returned Response from that call?

I am trying it this way

    Map<String, String> qParams = new HashMap<>();
    qParams.put("search","profile.customArrayAttr eq \"A1\"");
                              **"What goes here?"**);

I was trying to use ExtensibleResource for the GET call, but wasn’t able to make it work.

Note: I was able to get this work by using below construct

        ExtensibleResource response = client.http().get(

How do I convert ExtensibleResource to User list that the service actually returns?