Grouper Training - Administration - Lesson: Web Services
Getting started
Web Services wiki
Swagger documentation
https://grouperdemo.internet2.edu/grouper_v5/docs/
Hands On
1. Create a password for GrouperSystem
In your VM command line:
gte-gsh
When you get the GSH prompt:
new GrouperPasswordSave().assignApplication(GrouperPassword.Application.WS).assignUsername("GrouperSystem").assignPassword("password").save();
:q
2. Use the grouper client
In your VM command line:
gte-shell
Get the groups banderson is a member of
java -jar /opt/grouper/grouperWebapp/WEB-INF/lib/grouperClient-*.jar \
--wsUser=GrouperSystem \
--wsPass=password \
--wsEndpoint=http://localhost/grouper-ws/servicesRest \
--operation=getGroupsWs \
--subjectIdentifiers=banderson
Same with debugging to show the syntax
java -jar /opt/grouper/grouperWebapp/WEB-INF/lib/grouperClient-*.jar \
--wsUser=GrouperSystem \
--wsPass=password \
--wsEndpoint=http://localhost/grouper-ws/servicesRest \
--operation=getGroupsWs \
--subjectIdentifiers=banderson \
--debug=true3. Use a direct REST call
curl http://localhost/grouper-ws/servicesRest/5.16.0/subjects -X POST --user GrouperSystem:password -H 'Content-Type: application/json' --data '
{
"WsRestGetGroupsRequest":{
"subjectLookups":[
{
"subjectIdentifier":"banderson"
}
]
,
"enabled":"T"
}
}
'
4. Same but format using the jq command
curl http://localhost/grouper-ws/servicesRest/5.16.0/subjects -X POST --user GrouperSystem:password -H 'Content-Type: application/json' --data '
{
"WsRestGetGroupsRequest":{
"subjectLookups":[
{
"subjectIdentifier":"banderson"
}
]
,
"enabled":"T"
}
}
' | jq .