I am trying to create multiple groups via the Okta group API using requests. I have the following working to make a test group but now I need to figure out a way to pass 40+ group names into the body mapped to separate descriptions. I was thinking of using a yaml file with pyyaml but I just dont quite understand how to do that in this case. Any tips would be greatly appreciated.
#!/usr/bin/env python3
import requests
url = "https://{org}.okta.com/api/v1/groups"
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization" : "SSWS TESTKEY"
}
body = {
"profile": {
"name": "aws#test#api#00000000",
"description": "API Test Group"
}
}
r = requests.post(url, headers=headers, json=body)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!