CampusNexus Graph API Tutorial

I’m working on a presentation for CampusInsight and figured it would great to share some of the cool things you can do with the CampusNexus Graph API.  As most of you know, the CampusNexus Graph is based on an open protocol called OData.  OData is a standard for REST APIs that gives you the ability to query your model from any technology that supports HTTP.

With traditional web services, a developer is required at design time to define every method an external system would use to interact with an API .  In addition, the data being sent over the wire (contract) has to be pre-defined as well.  This produces rigid, inefficient and often difficult to use APIs.  OData gives us the flexibility and performance to handle the needs for almost all integrations without the requirement of modifying the API.  It pushes the ability of defining what you want to do to the consumer rather than the producer.

Campus Management has spent the last few years defining and refining the higher education model for the CampusNexus Graph.  As of 19.0, the CampusNexus Graph contains:

  • 987 Entities
  • 17,692 Properties
  • 2,067 Relationships

There are many tools that can be used to visualize and navigate data provided by services that adhere the OData specification:

  • Microsoft Excel
  • Microsoft Power BI
  • XOData
  • Microsoft SQL Server Reporting Services
  • etc.

In a later post, I will go into details on how to connect to OData services using these tools.

For now, I will give some examples of ways to query data services using the simple HTTP GET verb (something you can do simply by copying and pasting a URL into your browser).

Most web developers are familiar with Postman, an API Development Environment with the capability of discovering and testing modern web-based APIs.  The OData community has created a Postman collection to familiarize developers with a broad range of OData capabilities.  I’ve taken that collection and altered the URLs so they are specific to CampusNexus Graph entities.  Below are just a few examples of what you can accomplish using the Graph API:

Read the service root
http://hostname/odata/

Read the service meteadata
http://hostname/odata/$metadata

Read an entity set
http://hostname/odata/Courses

Get a single entity from an entity set
http://hostname/odata/Courses(1)

Select a property from an entity
http://hostname/odata/Courses(1)?$select=Name

Navigate to related entities
http://hostname/odata/Courses(1)/CourseType

Filter a collection
http://hostname/odata/Courses?$filter=CreditHours eq 3

Filter on nested structures
http://hostname/odata/Courses?$filter=CourseType/Name eq ‘Competency Based’

Filter using logic operators
http://hostname/odata/Courses?$filter=not(contains(Name,’science’))

Sort a collection
http://hostname/odata/Courses?$orderby=Name desc

Client-side paging
http://hostname/odata/Courses?$top=2&$skip=2

Counting the elements in a collection
http://hostname/odata/Courses/$count

Expand related entities
http://hostname/odata/Courses(1)?$expand=CourseType,CourseLevel

Select the properties
http://hostname/odata/Courses(1)?$select=Code,Name

Request full metadata
http://hostname/odata/Courses?$top=1&$format=application/json;odata.metadata=full

Invoke a bound function
http://hostname/odata/Courses/CampusNexus.GetStudentEnrolledCourseList(studentId=30151)

Leave a Reply

Skip to toolbar