Last updated on June 10, 2015

Extension Example: Hello World

Introduction

This extension simply reads the security token passed to it and invokes an API call to get details about the current user. The extension then displays the current users’ last login date and time. This extension uses JSON as the data interchange format.

Data Structures

A simple DTO (Data Transfer Object) is created in C# to represent the JSON message objects used by the API calls. We will utilize the Newtonsoft Json.Net library to serialize and de-serialize our DTO to JSON. The Appspace Graph API specifies the following JSON message structure example to request information about the current user.


The following is the equivalent C# DTO to represent the request message.

Workflow Class

We create a workflow class to handle the HTTP communication of the messages to the Appspace Graph API. The following is a code snippet of the method to get the current user information.

Extension Default Page

The following code snippet demonstrates the operation of the extensions’ default page that reads the security token from the query string, instantiates a workflow to send a message to request current user details and updates the user interface to show the users’ last log in time.