Getting the Group ID for adding a user to a group in Group Management through API
I am wanting to add an email to a group using the API 2.0 but do not know how to get the group number. I thought it would be the number in the URL when viewing the groups, as in:
https://admin.smartsheet.com/manage/groups/1234567 (yes, there are only 7 numbers)
I am using the following example from API documentation:
new_members = smartsheet_client.Groups.add_members( 7917992160847748, # group_id [smartsheet.models.GroupMember({'email': 'jane.doe@smartsheet.com'})] )
Here the group ID is a long number. When I use my 7 digit number (plus the rest of the needed code) I get the following error.
{"response": {"statusCode": 404, "reason": "Not Found", "content": {"errorCode": 1106, "message": "Group not found", "refId": "xnt296"}}}
So the code seems to be working, its just saying I have the wrong group ID number. I have written other python code to access Smartsheet so I know I have the basics working.
How do I get the correct group ID number?
Answers
-
Hi @Sasun
You can use List Org Groups to bring back Group information, such as the Group ID. Here's the documentation on this: https://smartsheet.redoc.ly/tag/groups#operation/list-groups
Cheers,
Genevieve