Affinity Web Service

Delivering Faculty Interests & Badges


The Affinity web service gives information acknowledging and celebrating teaching interests and accomplishments and helps promote faculty community and networking. This information is derived from the Research and Graduate Studies and faculty submitted information using Scholarship. The web service provides a gateway to access the information via a REST-ful API. The information is retrieved by creating a specific URI and giving values to filter the data. The information that is returned is a JSON object that contains a set of interest or badges attached to a particular member; the format of the JSON object is as follows:

  "success": "true",
  "status": 200,
  "api": "affinity",
  "version": "1.0",
  "collection": "badges",
  "count": 2,
  "badges": [
      "name": "Probationary Faculty Grant",
      "issuer": "Faculty Development",
      "url_image": "",
      "url_web": "",
      "award_date": "2014"
      "name": "Teaching Conference Grant",
      "issuer": "Faculty Development",
      "url_image": "",
      "url_web": "",
      "award_date": "Fall 2015"

Getting Started

  1. GENERATE THE URI: Find the usage that fits your need. Browse through subcollections, instances and query types to help you craft your URI.
  2. PROVIDE THE DATA: Use the URI to query your data. See the Usage Example session.

Loop through the data to display its information. See the Usage Example session.


All Badges Listing All Interest Listing


Specified person's Badges Specified persons by Badge Specified person's Interests

Code Examples


//construct a function to get url and iterate over
$(document).ready(function() {
  //generate a url
  var url = '';
  //use the URL as a request
    url: url
  }).done(function(data) {
    // save the degree list
    var badgeList = data.badges;
    //iterate over the degree list
    $(badgeList).each(function(index, badge) {
      //append each degree and institute
      $('#badge-results').append(''+ + '
by: ' + badge.issuer + '
'); }); }); });

//generate a url
$url = '';

//add extra necessary options
$arrContextOptions = [
    "ssl" => [

//perform the query
$data = file_get_contents($url, false, stream_context_create($arrContextOptions));

//decode the json
$data = json_decode($data, true);

//iterate over the list of data and print
foreach($data['badges'] as $badge){
	echo = $badge['name'] . '
by: ' . $badge['issuer'].'
'; }

import urllib2
import json

#generate a url
url = u''

#open the url
  u = urllib2.urlopen(url)
  data =
except Exception as e:
  data = {}

#load data with json object
data = json.loads(data)

#iterate over the json object and print
for badge in data['badges']:
  print badge['name'] + '\nby: ' + badge['issuer']

require 'net/http'
require 'json'

#generate a url
source = ''

#prepare the uri
uri = URI.parse(source)

#request the data
response = Net::HTTP.get(uri)

#parse the json
badges = JSON.parse(response)

#print the json
badges['badges'].each do |badge|
  puts "#{badge['name']}\nby: #{badge['issuer']}"