Getting 400 error while hitting groups endpoint

I have created API token and recorded the value to use in the application. With that I can see all the group details in postman.

But the same is not working with my java application and getting 400 error.

String oktaURL = "";
URL url1 = new URL(oktaURL);
httpsClient = (HttpsURLConnection) url1.openConnection();
httpsClient.setRequestProperty("Authorization", "SSWS xxxxxxxxxxx");
httpsClient.setInstanceFollowRedirects(false); ("Send the GET request");
// Send post request

Please shed some light with this issue.

I’m not very familiar with Java but what is the connection between oktaUrl and url1?

Missed to add a line. Updated.

API call didn’t work for me unfortunately got 405/400 error. Using okta sdk solved the issue. There is a built in listGroups method helped.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.