
hflt4 (hflt4) asked a question.
When I tried to call POST API to create a group, I got error. The request code is almost the same as on the https://developer.okta.com/docs/reference/api/groups/*create-group-rule
python3:
request_body = {
"type": "group_rule",
"name": "my test group",
"conditions": {
"people": {
"users": {
"exclude": []},
"groups": {
"exclude": []}
},
"expression": {
"value": "isMemberOfAnyGroup(\"00gjtfmh65gTwRMc80h7\")",
"type": "urn:okta:expression:1.0"
}
},
"actions": {
"assignUserToGroups": {
"groupIds": ["00gjxxxxxxxxxxxxx0h7"]
}
}
}
print(request_body)
create_grp_rule_response = requests.post(request_url, json=request_body, headers=headers).json()
print(create_grp_rule_response)
the result is:
{'type': 'group_rule', 'name': 'my test group', 'conditions': {'people': {'users': {'exclude': []}, 'groups': {'exclude': []}}, 'expression': {'value': 'user.role=="Engineer"', 'type': 'urn:okta:expression:1.0'}}, 'actions': {'assignUserToGroups': {'groupIds': ['00gjxxxxxxxxxxxxx0h7']}}}
{'errorCode': 'E0000022', 'errorSummary': 'The endpoint does not support the provided HTTP method', 'errorLink': 'E0000022', 'errorId': 'oaeGKhKV4KRRC-hItVfZE_thg', 'errorCauses': []}
I also tried request.post, it's the same error message.
While I tried the body part in Postman, it shows successful.
Can someone help to figure out how to fix this issue?

Hey there! Sorry for the lack of response here on the Discussions forum. If you’re still looking for an answer, I would recommend checking out our Developer resources, including the Developer Forum (https://devforum.okta.com/) and documentation. If you are unable to find the solutions you're looking for there, we would encourage you to contact our dedicated Developer Support team at developers@okta.com, and they will be able to help you out.