API Framework Reference

Top  Previous  Next

Overview

 

While the InFocus API supports native endpoints (e.g. written by Clearview) it also provides a framework for **building custom API's**.

 

Using the API Management applet, developers can create custom endpoints to meet the specific requirements of their firm's integrations.

 

The InFocus API is a REST API that uses standard HTTP to process requests. When creating a custom API, you'll need to consider the following.

 


 

Resources

 

Resources are used to group endpoints together. For example, an Employees resource might be created to organize all endpoints that handle requests for employee data.

 

Employees (Resource)
o/employees (Endpoint)
o/employees/{employee_code} (Endpoint)

 

API Documentation, which is self-generated by the API Management applet, is organized by Resource group. As required, Resources and their endpoints can be hidden from documentation.

 


 

Endpoints

 

An Endpoint is a unique URL through which a request can be made for an object or set of objects.

 

Each Endpoint can be configured with a Secure and Public route, allowed request methods and full object control.

 

For example /employees could be an endpoint that supports GET methods and returns an object that includes Employee Code and Employee Name for all active employees (e.g. https://cascowilson.infocusapp.com/employees)

 

Alternatively, /employees/{employee_code} could be an endpoint that supports GET, PUT and DELETE methods for returning, updating or deleting an employee specified in the request (e.g. https://cascowilson.infocusapp.com/employees/LJC01).

 

Endpoint requests and responses are sent in a JSON object (e.g. {"employee_code"="LJC01"}).

 


 

Routes

 

Routes define the URL used for submitting requests  to an Endpoint. Each Endpoint can support Secure and Public (optional) routes.

 

Secure Route - Requests made on this URL require an API Key
Public Route - Requests made on this URL are public

 


 

Request Methods (HTTP)

 

The InFocus API is a REST API that supports the following standard HTTP Request Methods:

 

GET - Retrieves data as specified by the request
POST - Creates data as specified by the request
PUT - Updates data as specified by the request
DELETE - Deletes data as specified by the request

 


 

Responses

 

Successful requests will return a JSON object.

 

For instance, using the /employees example above, a GET request would return:

 

 {

         "employee_code": "LJC01",

         "employee_name": "Lewis James Casco"

 },

 {

         "employee_code": "EPF01",

         "employee_name": "Erwin P. Fletcher"

 }

 

Sample responses can be viewed when testing via the API Management application or in the self-generated API documentation.

 


 

HTTP Status Codes

 

When making requests of the InFocus API, the following is an index of status codes returned.

 

200's Success - Indicates a successful request
o200 OK
400's Client Error - Indicates an error in the request from the client making the request
o400 Bad Request
o403 Forbidden
o409 Conflict
o401 Unauthorized
o404 Not Found
500's Server Error - Indicates an error from the server
o500 Internal Sever Error

 


 

Documentation

 

An API Reference is generated when installing or creating API's through the API Management applet.

 

The InFocus API is self-documenting in that it generates firm specific end-user documentation for each Endpoint organized by Resource group unless explicitly hidden.

 

Your unique API Reference is published to the route path of your InFocus API (e.g. https://company_name/infocusapp.com/api) and includes the following sections.

 

Introduction
Authentication
Errors
Resource/Endpoints - Each Resource and it's available Endpoints are described in detail with examples.