I am trying to hit the below endpoint and getting 405 error… got the userid from /userinfo
https://XXX.oktapreview.com/api/v1/users/userid/groups
But this URL works fine in postman and giving me the list of groups assigned to the user. but in java code its giving 405.
URL url1 = new URL(oktaURL);
httpsClient = (HttpsURLConnection) url1.openConnection();
httpsClient.setRequestMethod("GET");
httpsClient.setRequestProperty("Content-Type","application/json");
httpsClient.setRequestProperty("Authorization", "SSWS " + apiToken);
Please help…
Cale
2
405 errors indicate you’re using the wrong HTTP verb. GET is correct…any chance it was another verb at some point and you need to re-compile?
1 Like
I am not really sure about that. I did restart my system and also eclipse… it didnt not help.
andrea
4
Have you tried using our Java Management SDK? It has a built in listGroups method you can use to make this call for you.
1 Like
Thanks Andrea, this worked for me and I am able to get the groups with java SDK. Thank you.
One follow up question on this.
How to get the users list from the groups?
I tried listUsers method… this lists all the users from all the groups. I am looking for some way to get only users on a particular group in the SDK.
Please advice.
andrea
6
There’s a listUsers method you can use on a Group that should work
1 Like
This worked great. Thanks Andrea.
system
Closed
8
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.