How to find the address of CCB Group Profiles

In a recent email request, a fellow reader asked me how to go about finding and displaying the address of a CCB Group.

So, to round out the month, we’ll focus on using the CCB API to display the address, latitude, and longitude for CCB groups. There’s not much that will change in this tutorial other than the CCB service name and xpath reference.

I’m not going into great detail as the code is the code, so let’s get this party started.Use the CCB API service group_profiles to retrieve (GET) and display the address, latitude, and longitude for CCB groups.  In the example below, be sure to change the the xpath reference to be //groups/group.

Next, you’ll need to set or define the following variables: $groupId, $latArr, $longArr and $response_object.

Then just like in previous tutorials, iterate each element of the XML, or transform the XML to JSON and access the object.  In this example, I’ll keep to the old form and iterate the XML object for each group_profile element.

Next, concatenate each of the following element variables and their respective values to themselves, and then echo each variable: $groupId, $latArr, $longArr and $response_object.

You don’t have to concatenate the variable values as I did.  And you’re done retrieving data.  Now go and study up on how to display the data with some CSS and Javascript.  Make it look pretty now. 😉

It’s just that easy to use the CCB API to retrieve and display group profiles and their respective values (i.e, address, latitude, longitude, etc.).  That’s all for this tutorial.  Stay tuned…

 

 

 


Please comment if this tutorial has helped you.