Changes

SmartConnect - RESTful API

1,572 bytes added, 21:30, 22 June 2018
no edit summary
==Usage==
 
Make sure [[Creating JSON functions|JSON API functions]] were created in the instance before you can use them.
 
First, here are some rules to be aware of when calling the API functions.
 
* All update functions have a jsonrset parameter. When updating a record, the jsonrset must include all fields in the field list to ensure it works properly. If the value is not being changed, set it to the current value.
* If updating a new field, that field must also be added to the field list within the function configuration.
* Date fields in the jsonrset should be formatted as yyyy-mm-dd.
* Fields with pre-defined options (eg. drop down, check box, etc.) can be set by giving the stored value of the desired option, not the display caption
* The update functions are also used to create new records. This can be done by setting the recordid to 0. The response will then display the recordid of the record created.
 
=== ===
===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:
===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''': String containing the URL to which the request is sent* '''apitoken''': Encrypted token generated and associated to each SmartConnect function.
* '''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:
* '''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 JSON functions|using SmartConnect functions]].
 
<pre>Sample call within SmartSimple instance:
<pre>Sample Remote calloutside of Smartsimple instance:
function api_call() {
With every successful request a HTTP status of 200 is returned along with a JSON response body that contains the record field data.
For record Updates updates and creation, the response body will return the Record ID and a status of "Updated Successfully".
<pre>Sample Response format for Update:<br />
===Error Messages===
For failed requests, SmartSimple returns HTTP 4xx status codes.
 
The most common case is HTTP 401 Unauthorized which could indicate one of the following:
 
* Invalid authentication credentials provided
* User Account type is not of "API User"
* If performing remote calls, make sure the companyid parameter is correct
 
 
If the request is successful and the response is blank, review the following troubleshooting steps:
 
* Ensure the apitoken parameter is correct
* If updating, ensure the recordid is correct
* Review the post endpoint url is pointing to the correct resource
 
 
 
==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:
0
edits