We’re back with another tutorial this week. Last week, you learned how to create a group using the CCB API service create_group.
And although I had another tutorial due to post this week, I had a few questions raised about the CCB API service to update a group’s data.
So in this week’s tutorial, I’ll share with you how to update a group using CCB’s API service. Let’s get started!
First things first. I’m not going to bore you with the details as most of everything you’ll need to update a CCB Group using the API is exactly identical to the create_group API service.
There are a few differences as it relates to required variables between both services.
In addition, the update_group API service has 5-6 additional optional parameters that the create_group API service does not require or offer as optional parameters.
Some of the optional parameters of the update_group API service do require you to know integer values for person’s you’ll assign to various group positions.
You’ll need each person’s CCB individual id (hint, hint) and the group id that you’d like to update.
Feel free to read last week’s tutorial to make sense of all the inner workings should certain things about the update group code below confuse you.
Let me know if you have any questions and best wishes with this week’s tutorial.
<?PHP /** * update group profile */ // contains reusable globals and functions include("includes/config.php"); $apiService = 'update_group'; // CCB api service // group fields per CCB required and optional parameters // REQUIRED PARAMETERS $groupId = 1; // OPTIONAL PARAMETERS $groupName = 'Test Group Updated'; $groupDescription = 'This is a test group using the CCB API Create Group service.'; $campusId = 1; $groupTypeId = 9; $departmentId = 10; $areaId = 5; $groupCapacity = 30; $meetingLocationStreetAddress = '123 Testing Avenue'; $meetingLocationCity = 'Testing'; $meetingLocationState = 'TX'; $meetingLocationZip = '78729'; $meetingDayId = 3; $meetingTimeId = 5; $childcareProvided = true; $interactionType = 'Members Interaction'; $membershipType = 'Open to All'; $listed = true; $publicSearchListed = true; $inactive = false; $modifierId = 1; $ownerId = 5; $directorId = 9; $coachId = 10; $urlData = array_filter( array( 'srv' => "$apiService", 'name' => "$groupName", 'campus_id' => "$campusId", 'description' => "$groupDescription", 'group_type_id' => "$groupTypeId", 'department_id' => "$departmentId", 'area_id' => "$areaId", 'group_capacity' => "$groupCapacity", 'meeting_location_street_address' => "$meetingLocationStreetAddress", 'meeting_location_city' => "$meetingLocationCity", 'meeting_location_state' => "$meetingLocationState", 'meeting_location_zip' => "$meetingLocationZip", 'meeting_day_id' => "$meetingDayId", 'meeting_time_id' => "$meetingTimeId", 'childcare_provided' => "$childcareProvided", 'interaction_type' => "$interactionType", 'membership_type' => "$membershipType", 'listed' => "$listed", 'public_search_listed' => "$publicSearchListed", 'inactive' => "$inactive", 'modifier_id' => "$modifierId", 'owner_id' => "$ownerId", 'director_id' => "$directorId", 'coach_id' => "$coachId" ) ); $rss = ccbDetails('get',$urlData); // transform to XML $nodes = $rss->xpath('//groups/group'); // xpath for groups print_r($nodes); ?>