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:
ID | TABLE_SCHEMA | TABLE_NAME | TABLE_TYPE | TABLE_CODE | INSERT_OBJECT | UPDATE_OBJECT | DELETE_OBJECT |
---|---|---|---|---|---|---|---|
ZohoCRM | Contacts | HTTP | https://www.zohoapis.com/crm/v2/Contacts | POST {$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:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
ZohoCRM | Contacts | First_Name | Change | HTTP | PUT https://www.zohoapis.com/crm/v2/Contacts/{id}
{"data":[{"First_Name":@First_Name}]} | |||
ZohoCRM | Contacts | Last_Name | Change | HTTP | PUT 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: