To execute Insert, Update, and Delete statements against your data, you must first configure the corresponding write operation directives in the table definition. The values specified for the directives contain the REST verb to use for the operation and the endpoint for which you want the corresponding write operation enabled. For example, if you want to enable Insert statements for your endpoint, you must specify your endpoint using the #insert directive. See "Insert", "Update", and "Delete" for more information on SQL statement syntax.

Note: When enabling write operations for an endpoint, you can designate columns mapped from that endpoint as read-only using the #readonly element. Designating columns as read-only prevents data stored within from being inadvertently changed. See "Read-only columns" for examples and more information.

A table entry with insert, update, and delete operations enabled would take the following form:

"<table_name>": {
      "#path": ["<host_name_1/<endpoint_path_1>","<host_name_2/<endpoint_path_2>",...],
      "#insert": "<http_method> <host_name>/<operation_path>",
      "#update": "<http_method> <host_name>/<operation_path>",
      "#delete": "<http_method> <host_name>/<operation_path>",
      <column_definitions>
 },

Note that if your endpoint definitions require that you pass the values to be inserted or updated in an array in the POST body, then add square brackets ([] ) to the endpoint definition in the write operation directive:

"<table_name>": { 
      "#path": ["<host_name_1/<endpoint_path_1>","<host_name_2/<endpoint_path_2">,...],    
      "#insert": "<http_method> <host_name>/<operation_path>[]", 
      "#update": "<http_method> <host_name>/<operation_path>[]", 
      <column_definitions> 
 }, 
table_name
is the name of the relational table to which the driver maps the endpoint. For example, countries.
host_name_x
(optional) is the protocol and host name components of the URL endpoint. For example, http://example.com. You can omit this value by specifying the host name using the ServerName property.
endpoint_path_x
is the path component of the URL endpoint. For example, country. This can be an unparameterized or parameterized path, a path that uses query parameters, or an array of paths. Note that although it's possible to specify a single URL for the path, it is more typical that an array of URLs is necessary, as demonstrated here. See "Query paths" for examples and more information.
http_method
(optional) is the HTTP method used to perform the request for the specified write operation. By default, this method is POST for inserts, PUT for updates, and DELETE for deletes. The default values will work for many REST services; however, you may need to specify a different method according to the expectations of your API.
Note that for update operations, certain APIs require PATCH, PUT, or POST methods to send only updated fields in the POST body. This is the expected behavior for the PATCH method; therefore, if your API uses PATCH, you only need to specify PATCH as your HTTP method to send only updated fields. For example:
"#update": "PATCH http://example.com/countries/{id}",
However, the typical behavior for the PUT or POST methods is to overwrite data, effectively deleting your existing data and replacing it with an updated version. To configure the PUT or POST methods to send only updated fields, you must also set the #sendOnlyUpdated parameter to true. For example, the following will send only the updated fields using the PUT method:
#update”: "http://example.com/countries/{id}",
"#sendOnlyUpdated":"true"
operation_path
is the path component of the URL endpoint against which a write operation can be performed. For example, country. This can be an unparameterized or parameterized path, a path that uses query parameters, or an array of paths. See "Query paths" for examples and more information.

For example, the following entry enables Delete statements to be executed against data in the specified endpoint and the Countries table.

"Countries": {
         "#path": ["http://example.com/countries/",
                    "http://example.com/countries/{id}"]
         "#delete": "http://example.com/countries/{id}",
         "id":"VarChar(32)",
         "name":"VarChar(46)",
         "population":"Integer"
     },

The following example demonstrates an entry that enables the driver to insert the contents of an array element in a POST body.

"Countries": {
        "#path": ["http://example.com/countries/",
        "http://example.com/countries/{id}"]
        "#insert": "http://example.com/countries/{id}[]",
        "id":"VarChar(32)",
        "name":"VarChar(46)",
        "population":"Integer"
     },

Passing the primary key in the body of a request

In addition to passing the primary key in the URL endpoint (e.g., http://example.com/countries/{id}), some APIs require that the primary key is passed in the body of a request when performing a write operation. You can configure the driver to pass the primary key in the body of an insert or update operation by adding the corresponding operation element (#insert | #update) after the #key element. In the following example, the primary key is passed in the body of insert and update operations because the #insert and #update elements are specified in the column definition of the primary key.
{
"Countries":{
         "#path": ["http://example.com/countries/",
                   "http://example.com/countries/{id}"]
         "#insert":"http://example.com/countries/{id}",
         "#update":"http://example.com/countries/{id}",
         "id":"VarChar(32),#key,#insert,#update",
         "name":"VarChar(46),#readOnly", 
         "population":"Integer"
         }
}