grouper-users - Re: [grouper-users] calling getImmediateMembers method
Subject: Grouper Users - Open Discussion List
List archive
- From: Ben Beecher <>
- To:
- Subject: Re: [grouper-users] calling getImmediateMembers method
- Date: Tue, 28 Nov 2017 15:28:36 -0500
- Ironport-phdr: 9a23:SzbiJRPJoAjtlqKYoz0l6mtUPXoX/o7sNwtQ0KIMzox0Iv/5rarrMEGX3/hxlliBBdydsKMUzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZPebgFLiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0yRD+s7bpkSAXwhSgFOT438G/ZhM9tgqxFvB2svAZwz5LObYyPKPZyYqHQcNUHTmRBRMZRUClBD5uhYoQRCeoKIPtVoJfjqFQSrRuxGxOsD/7oxzBTmHD5w7E10+Q/HgHcxwEvA9UOsHDJrNXwL6gSUPq6wLPWwjrecvNbwDHw45XGfBAmpPGDR7NwcczJxEk1DQzEgFqQqY35Pz+PyusNtG2b4/JvVeKul24nqxxxrSO1ysgwjYnJg5oZyl/e9SV+3YY1PcO3SFRhbd+qC5tdsTyROYhuQs46Xm1kpiU3xqcGtJO/ZiQHyoorywTRZvGDa4SE/A7vWeKLLTp7hH9pYqyziwu9/ES6yODwSs+520tQoCVfiNnDrHUN2gTT6seZTvt9+V+s2TGS1wDP8uFEO0c0mrfeK5E7w74wkoYfvVnZEiDqhEr6lrOZdkIg+ui17uToebTmqYWGO4Bqlw7+L7wims25AesmLggDR3WX9fq/2bH5/UD0RK9Gg/8onqXDvp3XIdwXpqujDA9U1oYj5Qy/DzCj0NkAnXkIN0xJdR2cgof1PFHOJO34DfKkjFStijhn3e7JMaD8ApnVNHjMjK/hfaph605b0Aczwspf55VJCrEZPv3zQFb9tMHDDhAnKQy02P3qCNF81oMFRWKPGbGVPLnTsV+O+uIgPfOMZIkLtzbhNfQp/eDhgmIkmQxVQa780oEQdWi1BLF7OEiDelLthMsMC2EHolB4QeD323OYVjsGTXu0F4gx6zo7BZjuWY3OS4utjaap1yC/A5hcZ2kAB1yRRyS7P76YUusBPXrBavRqlSYJAOCs
Robert,
Thanks for sending the sample request in XML format. I was able to access the web service using that example. My Python code generates JSON and I get an error in the log when I use that request format with JSON:
2017-11-28 11:18:52 ERROR WsRestRequestContentType:204 - Error unparsing string with converter: edu.internet2.middleware.grouper.ws.rest.json.DefaultJsonConverter, {"WsRestGetMembersRequest": {"memberFilter": "Immediate", "includeSubjectDetail": "T", "wsGroupLookups": {"WsGroupLookup": {"groupName": "mystem:mygroup"}}}}
2017-11-28 11:18:52 ERROR GrouperRestServlet:226 - Problem with request: uri: /grouper-ws/servicesRest/v2_3_000/groups, method: POST, decoded url strings: 0: 'v2_3_000', 1: 'groups'
java.lang.RuntimeException: Problem unparsing string with converter: edu.internet2.middleware.grouper.ws.rest.json.DefaultJsonConverter, {
"WsRestGetMembersRequest":{
"memberFilter":"Immediate",
"includeSubjectDetail":"T",
"wsGroupLookups":{
"WsGroupLookup":{
"groupName":"mystem:mygroup"
}
}
}
}
at edu.internet2.middleware.grouper.ws.rest.contentType.WsRestRequestContentType$4.parseString(WsRestRequestContentType.java:205)
I was able to get the JSON code working when I changed the request format from this:
body = {
"WsRestGetMembersRequest": {
"includeSubjectDetail": "T",
"memberFilter": "Immediate",
"wsGroupLookups": {
"WsGroupLookup": {
"groupName": groupName
}
}
}
}
to this:
body = {
"WsRestGetMembersRequest": {
"includeSubjectDetail": "T",
"memberFilter": "Immediate",
"wsGroupLookups": [{
"groupName": groupName
}]
}
}
I spent about seven hours trying different variations so I am really glad it's working now.
Ben
On Wed, Nov 22, 2017 at 1:02 PM, Robert Bradley <> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 22/11/17 17:31, Ben Beecher wrote:
> I looked at the documentation for the Group class in the JavaDoc
> https://cdn.rawgit.com/Internet2/grouper/GROUPER_2_3_ BRANCH/grouper/do
c/api/edu/internet2/middleware/grouper/Group.html? view=co
>
> I see there is a method called getImmediateMembers. I would like
> to call that method using a Python script. I found sample code for
> the getMembers method in GitHub but I don't see any examples for
> getImmediateMembers:
> https://github.com/Internet2/grouper/tree/master/grouper- ws/grouper-ws
/doc/samples/getMembers
>
> I am using this Python code to call the getMembers method. How
> should I change it to access getImmediateMembers instead? result =
> self.grouperWSRequest(self.grouper_wsuri+"/groups/"+ I found that the following worked for me (using Kerberos/SPNEGOgroupName+"/member
s",
>
>
'GET')
>
authentication):
$ curl --negotiate -u:
'https://<grouper-ws-host>/servicesRest/v2_2_000/groups' --data
"@get_members.xml" --header 'Content-Type: text/xml; charset=UTF-8'
with get_members.xml reading:
<?xml version="1.0" encoding="UTF-8"?>
<WsRestGetMembersRequest>
<includeSubjectDetail>T</includeSubjectDetail>
<memberFilter>Immediate</memberFilter>
<wsGroupLookups>
<WsGroupLookup>
<groupName>teststem:mygroup</groupName>
</WsGroupLookup>
</wsGroupLookups>
</WsRestGetMembersRequest>
This gets sent as a POST request to the non-lite endpoint.
Hope that helps!
- --
Dr Robert Bradley
Identity and Access Management Team, IT Services, University of Oxford
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEgF3NFfO9FqlA+ME+ lGGnynav474FAloVu8YACgkQlGGnyn av
474SFA//WbfbqcFa7WJNBltsMSzNARhJ/ tFc2Om4HPCy5xIVH40E1S00qT0aQVA x
0sUjKjO+I0GaPQbNndC4IS04GP/0SHgJewKc8CG94bVfnZV3Wu3FSqEtD 1ETcMtf
v161BpBe2XbLNCBViREz4+2v4fLCPLBy7C5w2E8kUxS7TPHntWrX 7WjJ3xWPYG6/
sWCUqaXX1NoSyOaqBOFc2Ax0zWhTP0otJcCZfIgtcS70x6MMHFGwXEhM9tA4 LQAa
3mxOvMcTfj/jILgono/OMg/AGG5pxwRvhxEhrVLQ02ylBTMs5b3nW fz3Ua3hm4Wf
vVDs6U/q29cTwf/eeh5/vdOjn9hEJGjvYMrieIENvpkPBtSt6U QNFpk4bUWbluuf
Nz4houkORV2aGp6/dxva4sSgrnuEqoCy0IRV9nhJbQ2xnA 2ArpgeGZnoKUxGoinC
5oc8qWm6ZuD+oP5/WH3bkzuEeJ8Tuufeep1vw+ hnAX5VX7DfQbOJg55cDQ1ZX9A5
WnDROqxC6AArh7Gos3LbHIE/d97AJmXDaJRlVfiSxIlBivqqvKEaeo qCeuIoyBKN
YssdffCEzNzmZlPgfVQYEq2JgdpTDE1iNAegN6iA5GY3WHlPD6Ji64HzOUJg NSE6
/Lnkgz4x/LPDdv4mjxIUs3ETHlDKPfD9RoDumhA qW0EDjxAU9pc=
=LIX2
-----END PGP SIGNATURE-----
- [grouper-users] calling getImmediateMembers method, Ben Beecher, 11/22/2017
- Re: [grouper-users] calling getImmediateMembers method, Robert Bradley, 11/22/2017
- Re: [grouper-users] calling getImmediateMembers method, Ben Beecher, 11/28/2017
- Re: [grouper-users] calling getImmediateMembers method, Robert Bradley, 11/22/2017
Archive powered by MHonArc 2.6.19.