Context Services REST Interactive Demo

This page provides an interactive overview for using Context Services. It is designed to show an application developer how to build a simple but complete application using Context Services. The code segments exercise many of the Context Services REST API calls and demonstrate the JavaScript code for the API calls before and after they are executed, providing the results of the API calls first-hand.

Table of Contents

In the steps that follow, the boxes on the left show the code that is executed and the boxes on the right show the results of the API calls. This page works best with Chrome browsers version 23 and above.

See the Context Services Developer Guide here for an overview of application development using Context Services and Context Services REST API Reference here for details on the specific calls.

Get Started

To begin, register your application and obtain an application API Key and a Secret Key from the Intel® Cloud Services Platform Portal located here. This application API Key and Secret Key are required for your application to access all of Context Services.

Note: The application API Key and Secret key used for this demo aplication must be associated with the "devtest" environment, and the Callback URL must be set to urn:intel:identity:oauth:oob:async.

Enter your API Key and Secret Key in the boxes below, or use the default API Key and Secret below.

API Key:

Secret Key:

End User Log In

To access the Context Services API, the application must log the End User into the Intel services gateway with a user authorization token. Getting a user authorization token requires the following 3-step process:

  1. Call the Intel® Identity Services site to allow the End User to log in. Note: Include the appropriate Context Services scopes in your call. For this demo, the necessary scopes are context:location:checkin for getting point of interest check-ins, and context:post:location:checkin for posting check-ins.
  2. Request an OAUTH2 authorization code.
  3. Request an OAUTH2 access token.

This access token is required to access the rest of the Cloud Services Platform services, and is good for this session only.

Execute all three buttons in this order to fully create a session with the Intel services gateway, and get the access token.

To run the Intel Identity UI on its own, click here. This enables you to manually log out.

Log In to Intel® Identity Services

Get Authorization Code

Get Access Token

Identify Supported Context Types

The application can download a list of context types. The services returns a JSON schema describing all the types of context that the application can upload and download from Context Services. We will be using context type urn:x-intel:context:type:location:checkin:v1 for this test application. Note: you only need application authorization to download context types.

Download Context Types

Upload and Download Context Information

With the following code, the application can upload a sample context item of type urn:x-intel:context:type:location:checkin:v1.

Upload Test Item

Then, with the code below, the application downloads all of the previously uploaded items of type urn:x-intel:context:type:location:checkin:v1.

Download and View Test Items

Set a Watch and View New Items

The application can set a watch for a particular context type. A watch allows the application to download only the latest context items uploaded for a given context type. The following code sets a watch for new context items of context type urn:x-intel:context:type:location:checkin:v1.

Set a Watch

After you set the watch, go back up to the "Upload Test Item" section and click Execute to check in another context item. Then, execute the code below to view the context items uploaded since the watch was set.

View new Items

Complete the Demo

To complete the demo, you can delete the watches you have created.

Delete watches

For information about Intel® Developer Zone site user terms, see: Intel® Developer Zone Additional Terms