Challenge Overview
Build a service on the PaaS platform of your choice (Heroku, Cloud Foundry, App Engine, etc) that periodically calls the gamification service (GET) and retrieves new items to be posted to Badgeville. POST records to Badgeville and then update the successfully sent records in the gamification service by PUTting the record ids back to the Apex REST services. Therefore, only new records are sent to Badgeville each time the service is called.
��
The frequency of the polling should be configurable (no longer than 5 minutes) as well as the Badgeville endpoint and site identifier. For this challenge you can use the endpoint and the site identifier in the curl statement below.
��
The call to Badgville looks something like:
��
curl -d "site=appirio.com&user=davemess34@gmail.com&activity[verb]=cloud_metrics&activity[type]=schedule&activity[client]=appirio&activity[date]=12-12-12&activity[frequency]=daily" "http://sandbox.v2.badgeville.com/api/berlin/ae3b12fc93a4f863961116e6aba47a0e/activities.json"��
��
Our gamification service is impmemented as a Apex REST service. See this blog post for details of how to use Apex REST servcices if you are not familiar with them.
��
The zip file in the Assets section contains an ant script to install the custom object and Apex classes that you will need. The Apex test class contains example data for your convenience. Look at the Apex REST servcie code as it is very well documented. .
��
You can use the Apigee console to test the Apex REST service. Part of the ant installation is a Visualforce page that will generate a session id for you. You can use that session id for the OAuth authorization in the Apigee console. Look at the attached screenshots in the Assets section for more info.��
��