Changes

Jump to: navigation, search

SmartConnect - RESTful API

1,130 bytes added, 16:07, 25 October 2021
Searching of Empty or Non-empty Values
<!--66823 - SmartConnect grouping criteria-->
<!--75675 - SmartConnect field name and format consistency-->
* The number of records returned by a single SmartSimple API call is capped to 10000 records. If the criteria of your API call matches more than 10000 records, you will need to leverage the pagination parameters in order to make multiple calls to page through the results and return the full data set.
 
Custom parameters for List Functions are:
 
* criteria - this is an optional json array. This contains the following nodes: "andor", "field", "operator" and "value"
: "value" - value for the filter
: '''''sample1: '''''
: criteria: [{"andor":"and","field":"FIELDNAME","operator":"like","value":"PATTERN"},{"andor":"and","field":"FIELDNAME2","operator":"isempty","value":"true"}]
: sortby: [{"field":"FIELDNAME","direction":"asc"}]
: othersettings : {"getstorevalue":"1","keyformat":"0"}
: '''''sample2: '''''
: criteria: [{"andor":"and","field":"FIELDNAME1","operator":"=","value":"100"},{"andor":"or","field":"FIELDNAME2","operator":"like","value":"PATTERN"},{"andor":"and","field":"FIELDNAME3","operator":"isempty","value":"false"}]
: sortby: [{"field":"FIELDNAME","direction":"desc"}]
: othersettings : {"getstorevalue":"0","keyformat":"0"}
|}
===Pagination===
4 new parameters are introduced and should be put inside the "'''othersettings'''" in json object for the API call<br />- ''' recordstart, recordend, recordsperpage, pagenum'''<br />*Note: othersettings parameter is also used for other settings introduced earlier, ie. getstorevalue and keyformat, so your othersettings json can look something like this:<br />{"getstorevalue":"1","keyformat":"1","recordsperpage":100,"recordstart":1000}
'''Note: only up to 10000 records will be returned for each API call, so multiple API calls will be required to display all records with respective pagination parameters'''<br /><br />Returned json response will include the following (in the message json node) for all records, despite the above parameters have been set or not, results are based on the order by (sortby declared in API call or by default order by, eg. order by L1 ID asc):<br />- '''recordfrom ''' (starts from record number xxx)<br />- '''recordto ''' (last record number returned xxx)<br />- '''recordcount ''' (number of records returned in this API call)<br />- '''allcount ''' (number of records in total without the limit)<br />Returned Response:<br />e.g. "message":{"recordto":424,"recordcount":100,"allcount":460,"recordfrom":325}<br /><br />Priority of operations with the 4 new parameters:<br />1. when recordend > 0, only recordstart and recordend parameter will be taken into consideration, eg.<br />othersettings: {"recordend":35} - will return records from start up to and including 35th record, total records = 35<br />othersettings: {"recordstart":10,"recordend":35} - will return 10th to 35th record, total records = 26<br />othersettings: {"recordstart":10,"recordend":350,"recordsperpage":100} - will ignore recordsperpage because you have specified the start and end, return record 10 to 350, total 341 records
<br />2. pagenum > 0 and recordsperpage > 0, (to use pagenum, recordsperpage has be to specified), will ignore recordstart and recordend<br />othersettings: {"recordsperpage":50,"pagenum":2} - return records 51-100<br />othersettings: {"recordsperpage":100,"recordstart":12,"pagenum":1} - will ignore recordstart, return records 1-100<br />othersettings: {"recordsperpage":100,"recordstart":12,"pagenum":3} - will ignore recordstart, return records 201-300
<br />4. recordstart > 0<br />othersettings: {"recordstart":12}, return all records starting from record 12, up to only 10000 number of records
 
 
 
===Searching of Empty or Non-empty Values===
Add criteria to search for records where a field is empty or not. You may now include an operator of isempty, with a corresponding value of either true or false, within a criteria in order to search for records based on either empty or non-empty value.
 
e.g. criteria:[{"andor":"and","field":"cf_123456","operator":"isempty","value":"true"}]
 
===Hourly API Call Limit===
<!--125991 - Throttle API calls-->
API calls in excess of 1000 per instance within the past hour will receive an error and blocked from using API until the total API calls count in the last hour drops below the limit.
=SmartConnect Examples=
Smartstaff
1,385
edits

Navigation menu