google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

[Admin API] Insert email with + sign into a google group fails

Open kushagra-arta opened this issue 3 years ago • 1 comments

https://developers.google.com/resources/api-libraries/documentation/admin/directory_v1/python/latest/admin_directory_v1.members.html#insert

Environment details

  • OS type and version: Ubuntu 20.04.5 LTS
  • Python version: 3.8.13
  • pip version: 22.0.4
  • google-api-python-client version: 2.27.0

Steps to reproduce

  1. Try to insert any email with a + sign into a group -> 404 Error
  2. Exactly same code with an email without the + sign works -> 200.

Code example

...
service = build('admin', 'directory_v1', credentials=creds)
new_member = {'email': '<any email with + e.g. [email protected]'>, 'role': 'MEMBER'}
service.members().insert(groupKey=<group_id>, body=new_member).execute()

Stack trace

<HttpError 404 when requesting https://admin.googleapis.com/admin/directory/v1/groups/<group_id>/members?alt=json returned "Resource Not Found: [email protected]". Details: "[{'message': 'Resource Not Found: [email protected]', 'domain': 'global', 'reason': 'notFound'}]">

The same email when inserted via UI works.

kushagra-arta avatar Nov 17 '22 04:11 kushagra-arta

@kushagra-arta Could you please check whether you run into syntax error or not while executing it on your local machine, cause somehow I have this feeling that it might be related to the syntax error. It would be great if you could replace the two last lines with these and check the result:

new_member = {'email': '[[email protected]](mailto:[email protected])', 'role': 'MEMBER'} service.members().insert(groupKey='group123456', body=new_member).execute()

aria1991 avatar Jan 17 '23 15:01 aria1991