Error adding user to group via API

Hello,

I’m attempting to add users to a group via API. I got no results from my python script. When I test in Postman, I receive the following:

{
    "errorCode": "E0000022",
    "errorSummary": "The endpoint does not support the provided HTTP method",
    "errorLink": "E0000022",
    "errorId": "oaeru5O9-k_SxGkoQxjxwx26w",
    "errorCauses": []
}

Call in postman is {{url}}/api/v1/groups/{{groupId}}/users/{{userId}}

Are you doing a PUT as per our API docs?

Yes I am.

Can you remove those ' quotes and retry?

Error is the same:

{
    "errorCode": "E0000022",
    "errorSummary": "The endpoint does not support the provided HTTP method",
    "errorLink": "E0000022",
    "errorId": "oaeWeFzpcZERJ-X3u-0bv2Z2w",
    "errorCauses": []
}

I also checked the {{groupId}} collection variable and removed the quotes from it. Request returned the same result as above.

Hmm… What type of group is this? Is it a local Okta group (created on the Okta side) or is it an application group (imported from some other application, like Workday, Google, etc)?

This is a group that was created by us locally in Okta. It wasn’t imported from the O365 application.

Any further ideas on what could be causing this? We wound up having to brute force add the users to groups, but would still like to have this functionality

Would you be able to share the value for the x-okta-request-id response header when you make this request so I can try to check our logs for more details?

I am currently not seeing that as a response header in Postman. Is there something that I need to add to the headers or body of the request? Current response headers are Date, Content-Type, Transfer-Encoding, Connection, Server, Public-Key-Pins-Report-Only, x-content-type-options, and Strict-Transport-Security.

Hmm… it should just come back when you make the request to Okta

It does when I do a different request (for example, a search of groups GET {{url}}/api/v1/groups?q=365), but when I try the PUT request detailed above, I only get the headers that I listed along with the status message “405 Method Not Allowed” as previously detailed.

Are you sure you have the groupId variable set correctly? I’m seeing GETs to this URL that look like this that are returning a 405: /api/v1/groups/groupId/users/00u16041nqJqudi6p697

Also, you will want to remove the -admin from your {{url}} variable, as its not needed when making API calls to your org

Thank you for pointing out the issue with the variable. I fixed it then ran a request replacing the variable with the actual group ID. Just to be safe, I also replaced the url to remove -admin from it and then ran the test again in Postman with the variables replaced with the actual information the variable represented. New call was PUT <orgname_redacted>.okta.com/api/v1/groups//users/ and still got the 405 error. Do you see the most recent call?

Date: Tue, 21 Feb 2023 22:18:21 GMT

I’m still seeing GETs on our side instead of PUTs, the most recent of which was at Feb 21 22:18:21 GMT.

I used a curl command to try this and it seemed to work, or at least not error. Could you check x-okta-request-id: Y_ZSOV7VnIVSdMlHsjZhpgAAD2Q and see if that shows as a PUT request?

Yup, that one was a PUT that resulted in a 204, looks like the user was added successfully from what I can tell

It looks like Postman is sending Put requests as Get requests… Thanks for all of the help!

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