carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

Problems with Google Apps Groups Provisioning Client API #597

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Instanciate a Groups Provisioning Client (downloaded today the python client 
gdata-2.0.16.tar.gz): 
groups_client = gdata.apps.groups.client.GroupsProvisioningClient(
            domain=CONSUMER_KEY)
2. Try to add a member to a group:
groups_client.add_member_to_group('myuser@mydomain.com.br', 
'mygroup@mydomain.com.br')
3. Get an Error:
RequestError: Server responded with: 400, <?xml version="1.0" encoding="UTF-8"?>
<AppsForYourDomainErrors>
  <error errorCode="1801" invalidInput="myuser@mydomain.com.br" reason="InvalidValue" />
</AppsForYourDomainErrors>

What is the expected output? What do you see instead?

Expected output is some OK response. I see a RequestError 400

Please use labels and text to provide additional information.

I corrected the error changing line 307 of 
/gdata-2.0.16/src/gdata/apps/groups/client.py to:
  def add_member_to_group(self, member_id, group_id, member_type=None,
Before was:
  def add_member_to_group(self, group_id, member_id, member_type=None,

Could you check if you guys have the same error ?

Original issue reported on code.google.com by gabrielh...@gmail.com on 12 Feb 2012 at 5:59

GoogleCodeExporter commented 9 years ago
Hi Gabriel,

The problem is actually in the documentation and not in the client library.
The correct usage is 

add_member_to_group(self, group_id, member_id, ...)

with group_id and member_id as first and second parameter respectively.
Thanks for reporting this issue, I'll have the documentation fixed.

Claudio

Original comment by ccherub...@google.com on 13 Feb 2012 at 10:19

GoogleCodeExporter commented 9 years ago
I just realized the samples in the docs use the GroupsService class and not the 
GroupsProvisioningClient class which was more recently added to the library.

The GroupsService.AddMemberToGroup method has the following signature:

def AddMemberToGroup(self, member_id, group_id)

which is also the one presented in our docs.

Original comment by ccherub...@google.com on 13 Feb 2012 at 10:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
From 
http://code.google.com/googleapps/domain/provisioning_API_v2_developers_guide.ht
ml#Create_Member_Example we have:

"
import gdata.apps.groups.client
...
groupClient = gdata.apps.groups.client.GroupsProvisioningClient(domain=domain)
groupClient.ClientLogin(email=email, password=password, source ='apps')
groupClient.AddMemberToGroup(member_id, group_id)
"

It must be used:
"groupClient.AddMemberToGroup(group_id, member_id)"

So, yes the docs are wrong. I didn't understand your 2nd comment. Are you just 
saying  the sample must be re-done?
Thank you so much.

Original comment by gabrielh...@gmail.com on 13 Feb 2012 at 10:42

GoogleCodeExporter commented 9 years ago
Another point is that all docs are wrong. Eg:
"
import gdata.apps.groups.client
...
groupClient = gdata.apps.groups.client.GroupsProvisioningClient(domain=domain)
groupClient.ClientLogin(email=email, password=password, source ='apps')
groupClient.RemoveMemberFromGroup(member_id, group_id)
"
and in client.py:
"def remove_member_from_group(self, group_id, member_id, **kwargs):"

Or maybe who wrote client.py (you?) reverted everything compared to service.py. 
Eg in service.py:
"
def RemoveMemberFromGroup(self, member_id, group_id):
def RetrieveMember(self, member_id, group_id):
...
"

Original comment by gabrielh...@gmail.com on 13 Feb 2012 at 10:49