Why do I get "Bad Request" for Sharing Group with User?

agdev Posts: 3 ✭✭
edited July 2022 in Deployment & Integrations

I'm trying to use the TeamViewer API to share a group with a user.

To obfuscate the user ID and group ID, I will use $user and $group to represent their respective IDs.

If I run GET https://webapi.teamviewer.com/api/v1/users/$user, I can verify that a user does exist and is active for that user ID.

Similarly, I ran GET https://webapi.teamviewer.com/api/v1/groups/$group to verify that the group does exist, and is not currently shared with $user.

Now, I try running POST https://webapi.teamviewer.com/api/v1/groups/$group/share_group with my token in the Authorization header and a JSON body as follows:

{'users': [ { 'userid': '$user', 'email': 'user@mycomp.com', 'permissions': 'read' } ] }

But in response I get a 400 status BAD REQUEST error. Is there something syntactically wrong here? I've confirmed both the user ID and group ID exist via the API, so I'm running out of ideas for what is happening.