CalGroups API Information

Web Services Account

Contact calnet-admin@berkeley.edu to request a web services account.

 General Information

uri  = /gws/servicesRest/json/v2_2_100/(groups|stems)/(group|stem name)
headers: Content-Type=text/x-json
Basic HTTP Authentication - Make sure that the api account has admin access to your groups and folders. Just add it as you would add person accounts to the admin group associated with a folder.

Methods

Add Member (add member UID to group)
Use person UID or group UUID as subjectId. Can replace membership with this list by setting replaceAllExisting to T.

URN:

PUT https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/edu...

Body:

{
     "WsRestAddMemberRequest":{
          "replaceAllExisting":"F",
          "subjectLookups":[
             {"subjectId":"212374"},
             {"subjectId":"c466a9d915044c72a67e8999f2d3ce4b"},
             {"subjectId":"212375"}
         ] 
     }
}

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Delete Member (delete member UID from group)

Can also delete a nested group using UUID.

DELETE https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/edu...

DELETE https://group-test.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/ed...
Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Get Members (get list of all group members)
GET  https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/edu...

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...


Get Groups (get list of all groups where UID=1234 is a member)

Group Save (create a group) (can add description parameter as well)

POST https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/edu...? \
wsLiteObjectType=WsRestGroupSaveLiteRequest&groupName=edu:berkeley:app:edu:berkeley:app:someapp:testgroup

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Group Delete (delete a group) 

Stem Save (create a new stem or folder)

POST https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/stems/edu:...? \
wsLiteObjectType=WsRestStemSaveLiteRequest&stemName=edu:berkeley:app:edu:berkeley:app:someapp:teststem

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Has Member (Is member UID in group)
GET  https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups/edu...
Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Find Groups
finds all groups under specified stem

POST https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups? \
wsLiteObjectType=WsRestFindGroupsLiteRequest&queryFilterType=FIND_BY_STEM_NAME \
&stemName=edu:berkeley:app:someapp

find groups by name

POST https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups? \
wsLiteObjectType=WsRestFindGroupsLiteRequest&queryFilterType=FIND_BY_GROUP_NAME_APPROXIMATE \
&stemName=edu:berkeley:app:someapp&groupName=test

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Create a Composite Group

This method allows saving multiple groups at once, so the left/right groups can also be created before the composite group. See reference below.

URN:
https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/groups

BODY:
{
   "WsRestGroupSaveRequest":{
      "wsGroupToSaves":[
         {
           "wsGroup":{
               "description":"my composite group description",
               "detail":{
                    "compositeType":"intersection",
                    "hasComposite":"T",
                    "leftGroup":{
                           "name":"edu:berkeley:official:employees:all-emp"
                    },
                    "rightGroup":{
                           "name":"edu:berkeley:app:someapp:my-adhoc-group"
                    }
               },
               "name":"edu:berkeley:app:someapp:my-composite-group"
           },
           "wsGroupLookup":{
                    "groupName":"edu:berkeley:app:someapp:my-composite-group"
           }
         }
      ]
   }
}

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Add an Attribute to a Group
Use this to add a provisioning attribute to a group. In this case, the sync to google attribute. Your app credentials need to have access to the attribute and group. This method will work if no attribute is set or if it exists and is set to "no". 
The example below uses the attribute for syncing to Google.

The attributes for LDAP and AD are:
etc:attribute:provisioningTargets:ldap:syncToLDAP
etc:attribute:provisioningTargets:ad:syncToAD

URN:

POST https://calgroups.berkeley.edu/gws/servicesRest/json/v2_2_100/attributeA...

Body:

{
   "WsRestAssignAttributesLiteRequest":{
       "attributeAssignOperation":"assign_attr",
       "attributeAssignType":"group",
       "attributeAssignValueOperation":"replace_values",
       "valueSystem":"yes",
       "wsAttributeDefNameName":"etc:attribute:provisioningTargets:googleProvisioner:syncToGooglebcon",
       "wsOwnerGroupName":"edu:berkeley:app:someapp:my-group-to-sync-to-google"
   }
}

Reference: https://github.com/Internet2/grouper/blob/master/grouper-ws/grouper-ws/d...

Support 

Request access via a folder space using a Service Request form in ServiceNow.

If you have questions about CalGroups, including API questions, contact: calnet-admin@berkeley.edu.