How to retrieve a list of campuses using CCB API

As I was cleaning up my inbox a few days ago, I stumbled across an email from a CCB Tribe member.

In this email, the person questioned how to go about establishing a list of campuses via the CCB API.

So, you guessed it! Yes, today’s tutorial is about using the CCB API to retrieve a list of campuses.

If you’re not familiar with CCB and campuses or your church has only one campus, then no worries at all.

But for the multi-campus churches, this tutorial will help you establish a list of campuses to use for your own 3rd-party applications and reporting capabilities.

I won’t bore you with the step-by-step details. Feel free to read previous tutorials for explanation about certain parts of the code.

All in all… Whether you’re wanting to create a filter list, a drop down menu of campus selections, or whatever you can imagine, it’s quite simple to retrieve a list of campuses.

That’s it for today’s tutorial. Feel free to leave comments below should you have questions or need further assistance. See you back here next week.

<?PHP

// contains resusable globals and functions
include("includes/config.php");

$apiService = 'campus_list'; // CCB api service

$urlData = array_filter( array(
	'srv' => "$apiService"
	) );

$rss = ccbDetails('get',$urlData); // transform to XML

$nodes = $rss->xpath('//campuses/campus');  // xpath for campuses->campus

$response_object = '';

foreach ($nodes as $node)
{
    $response_object .= $node->name."<br/>";  // now print the campus name (See CCB API documentation for more $apiService fields)
}

echo $response_object;

?>

 

Related Posts

Subscribe and receive the following...

  • Inside CCB tips and tricks
  • Instant CCB tutorial alerts and updates
  • CCB How To's, Videos, Webinars and more...