Change Handlers Using REST API

Change Handlers Using REST API

SaveToDB 10 allows configuring REST API services in a database as shown in Getting Data Using REST API and Saving Data Using REST API.

In short, the configuration looks like this:

IDTABLE_SCHEMATABLE_NAMETABLE_TYPETABLE_CODEINSERT_OBJECTUPDATE_OBJECTDELETE_OBJECT
 ZohoCRMContactsHTTPhttps://www.zohoapis.com/crm/v2/ContactsPOST {$url}

{"data":[{@json_row_values}]}
PUT {$url}/{id}

{"data":[{@json_row_values}]}
DELETE {$url}/{id}

The configured ZohoCRM.Contacts object has the same configuration features as other native database objects.

So, developers can configure change handlers using the xls.handlers table.

Here is a sample:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 ZohoCRMContactsFirst_NameChangeHTTPPUT https://www.zohoapis.com/crm/v2/Contacts/{id}

{"data":[{"First_Name":@First_Name}]}
 ZohoCRMContactsLast_NameChangeHTTPPUT https://www.zohoapis.com/crm/v2/Contacts/{id}

{"data":[{"Last_Name":@Last_Name}]}

The HANDLER_CODE field contains HTTP commands used to update a data source.

The REST API must support updating single fields to use this method. Otherwise, use regular saving changes.

The URL can contain parameters in the curly brackets like {id} in the sample.

The add-in populates such parameters from table columns and selects URL parameters.

The body can contain parameters prefixed with the @ character.

See more details about the HTTP commands: