Difference between revisions of "SmartConnect - RESTful API"
m |
|||
Line 48: | Line 48: | ||
|- | |- | ||
||cf_''CustomFieldName'' | ||cf_''CustomFieldName'' | ||
− | ||Custom fields are denoted by their field name, preceded by a prefix of 'cf_' | + | || |
− | ||cf_My Custom Field | + | Custom fields are denoted by their field name, preceded by a prefix of 'cf_'. |
+ | |||
+ | While it is best practice to reference the field name, you may also reference the field ID. | ||
+ | |||
+ | || | ||
+ | cf_My Custom Field | ||
+ | |||
+ | cf_fieldid | ||
+ | |||
|- | |- | ||
||;; | ||;; | ||
Line 123: | Line 131: | ||
* Any existing and applicable template formulas will be triggered and run after a record update. | * 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. | * Any existing and applicable workflows will be triggered and run after a record update. | ||
+ | * Any existing and applicable status-triggers will run for any status change after a record update. | ||
=Configuration - Advanced= | =Configuration - Advanced= | ||
=Appendix= | =Appendix= | ||
==Creating SmartConnect functions== | ==Creating SmartConnect functions== | ||
− | SmartConnect functions are created for each individual instance of SmartSimple. | + | SmartConnect functions are created for each individual instance of SmartSimple. You can create multiple functions of the same action if needed, depending on the field list returned. |
− | + | See [[Creating JSON functions|Creating and Managing SmartConnect Functions]] for a more detailed look at creating functions. | |
==Standard Field Names== | ==Standard Field Names== | ||
− | + | See [[JSON API (SmartConnect) Standard Field Names|SmartConnect Standard Field Names]] for a list of available Standard Fields that you can reference along with update restrictions. | |
The standard fields available for reference varies on the Record Type selected in the API call. | The standard fields available for reference varies on the Record Type selected in the API call. | ||
Line 141: | Line 150: | ||
==Options and Settings== | ==Options and Settings== | ||
− | |||
===Available Record Types=== | ===Available Record Types=== | ||
{| class="wikitable" | {| class="wikitable" |
Revision as of 15:15, 22 June 2018
Please note that this page is currently under construction. There is more information to come. |
Contents
Overview
SmartSimple's SmartConnect API provides a relatively easy to use method of integrating SmartSimple information with other web services and systems. It is a RESTful API and loosely follows the principles of REST integration.
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.
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.
- Within your SmartSimple instance, define an API function within the Global Settings -> Integrations -> SmartConnect API screen.
- In this screen you will find options for Record 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.
- 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_'. See Appendix for a list of Standard Field names for each object. |
sf_First Name |
cf_CustomFieldName |
Custom fields are denoted by their field name, preceded by a prefix of 'cf_'. While it is best practice to reference the field name, you may also reference the field ID. |
cf_My Custom Field cf_fieldid |
;; | 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 Record Type of the API function. The general endpoint will be in the form of:
/API/APIVersion/recordtype/
The full list of endpoints is below.
Record 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 | /API/1/sysvar/ | https://example.smartsimple.com/API/1/sysvar/ |
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 | /API/1/transactions/ | https://example.smartsimple.com/API/1/transactions/ |
Message Body
The message body that you post will need to include various parameters depending on the Record 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.
- Any existing and applicable status-triggers will run for any status change after a record update.
Configuration - Advanced
Appendix
Creating SmartConnect functions
SmartConnect functions are created for each individual instance of SmartSimple. You can create multiple functions of the same action if needed, depending on the field list returned.
See Creating and Managing SmartConnect Functions for a more detailed look at creating functions.
Standard Field Names
See SmartConnect Standard Field Names for a list of available Standard Fields that you can reference along with update restrictions.
The standard fields available for reference varies on the Record Type selected in the API call.
Options and Settings
Available Record 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 record 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. |
Variables Replace | Returns formatted content processed by the variable processor from a specified record. The system will replace all variables within the content parameter with variable values from that record. E.g. Passing in "Hello @firstname@" as content for a contact named John Smith will return "Hello John". |