SmartConnect - RESTful API

From SmartWiki
Revision as of 17:35, 11 June 2018 by Chin (talk | contribs) (Created page with "{{Banner-UnderConstruction}} =Overview= SmartSimple's SmartConnect API provides a relatively easy to use method of integrating SmartSimple information with other web servic...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Construction warning.png Please note that this page is currently under construction. There is more information to come.


Overview

SmartSimple's SmartConnect API provides a relatively easy to use method of integrating SmartSimple information with other web services and systems.

This API uses industry standard JSON syntax and constructs. If you are not familiar with JSON you should take a look at the following tutorial before venturing much further in this topic.

Interactive Demonstration Page

For a demo of how the API works, you can test some sample functions on our interactive demonstration page. This page is connected to a specific demonstration instance containing sample data. We strongly encourage you to review this page in order to gain a better understanding of the syntax and functionality of the API.

Prerequisites

  • This API is only available for SmartSimple environments on the November 2015 release or later. We recommend you upgrade to the latest available release for the most up to date API functionality.

Configuration - Essentials

Initial Setup

You will need an active SmartSimple user account in order to make any API calls. There are two modes of operation for this API, and if you are planning on making remote calls you will first need to create and activate an API type user.

  • Active session: Where a user is already logged into SmartSimple with an active session and makes an API call from their web browser, e.g. an AJAX call. The user's existing session is used to authenticate the API call.
  • Remote call: Where an external system makes an API call. For this method, a user account of type API Access is required to authenticate the API call.
    Roles and access setting of a user to be used for remote calls.

Function Definition

In order to use the API, you must first define the set of functions you wish to make available within SmartSimple. This is an added layer of security that lets you limit the available functions as well as field sets that you wish to expose through the API.

  1. Within your SmartSimple instance, define an API function within the Global Settings -> Integrations -> SmartConnect API screen.
  2. In this screen you will find options for Object Type, Action Type, and Field List that define respectively, the type of record, the action to perform, and the field list that will be exposed for this function.
  3. After saving your function, take note of the API Token as you will need to include this in your API calls to identify this pre-defined function.

Here is a more detailed look at creating SmartConnect functions.

Field List Syntax

The Field List option within the function configuration is used to define which fields are retrievable through the function call. This is a free form text box in which you will need to construct your field list with the following syntax:

Syntax Description Example
sf_StandardFieldName Standard fields are denoted by their name, preceded by a prefix of 'sf_' sf_First Name
cf_CustomFieldName Custom fields are denoted by their name, preceded by a prefix of 'cf_' cf_My Custom Field
 ;; Field Separator. Multiple fields are separated using the literal characters ';;' sf_First Name;;cf_My Custom Field

Usage

Posting Endpoints

To make an API call you will need to post to the appropriate endpoint which will simply be based on the Object Type of the API function. The general endpoint will be in the form of:

/API/APIVersion/objecttype/

The full list of endpoints is below.

Object Type Endpoint Example
Report /API/1/report/ https://example.smartsimple.com/API/1/report/
Company /API/1/company/ https://example.smartsimple.com/API/1/company/
User /API/1/user/ https://example.smartsimple.com/API/1/user/
System Variables
UTA Level 1 /API/1/levelone/ https://example.smartsimple.com/API/1/levelone/
UTA Level 2 /API/1/leveltwo/ https://example.smartsimple.com/API/1/leveltwo/
UTA Level 3 /API/1/levelthree/ https://example.smartsimple.com/API/1/levelthree/
UTA Level Transaction

Message Body

The message body that you post will need to include various parameters depending on the Object Type and Action Type being used. The required and optional parameters will be listed for each different function on the configuration page of each SmartConnect function. At minimum though, you will always need to include:

  • url: The URL to post to.
  • apitoken: The unique ID generated and associated to each SmartConnect function.

If you are making a remote call from an external system you will also need to include:

  • username: The email address of an active API type user account.
  • password: The corresponding password to the above user account.
  • companyid: The root companyid of your SmartSimple instance. This is the companyid of the organization at the root of your instance.
  • alias: The web alias of your SmartSimple instance. This will typically be the leading portion of your instance URL, and can be found in your Global Settings -> Branding configuration. E.g. for https://example.smartsimple.com the alias would be 'example'.

Here is a more detailed look at using SmartConnect functions.

Update Behaviour

Please note when performing updates that the system behaviour will be similar to that of saving the record in the regular browser interface. Namely, the following will occur:

  • Any existing and applicable template formulas will be triggered and run after a record update.
  • Any existing and applicable workflows will be triggered and run after a record update.

Configuration - Advanced

Appendix

Options and Settings

Available Object Types

Record Description
Report Run a report and retrieve the results.
Company Organization records.
User Contact records.
System Variables Global System Variables.
UTA Records UTA records, including Level 1, 2, 3, and transactions.

Available Action Types

The following is a full list of available actions. Please note that not all actions will be available for all object types.

Action Description
Get Retrieve a single record for the record type you have selected in the function.
List Retrieve multiple records for the record type you have selected in the function.
Update Update one or more fields for the specified record/s. Update is also used to create new records.
Get Meta Retrieve the configuration settings for a UTA with respect to Level 1/2/3 attributes such as types, statuses, field definitions.
Update Meta Update the configuration settings for a UTA with respect to Level 1/2/3 attributes such as types, statuses, field definitions.
Download File Download a single file from a specified record and field.
List Files Retrieves a list of files from a specified record and field.
Search Files Retrieve a list of files containing specified string values.
Update Associations Update one or more fields in the association table between two records. Update is also used to create new association records. E.g. The contacts or organizations associated to a UTA Level 1 record.
List Associations Retrieves a list of associations for the specified record. E.g. The contacts or organizations associated to a UTA Level 1 record.
List Multiple Addresses Retrieves a list of addresses for the specified contact or organization record.
Update Multiple Addresses Update one or more fields for the specified address for a contact or organization record. Update is also used to create new address records.

Examples