Update Features Using SQL

Description

Updates features in a table by performing a query on a table using an MI SQL Update command string. In some cases the table will need a primary key column, depending on the data provider and the query. See the MapInfo SQL Language Reference for detailed information on MapInfo SQL functions.

Note: You must have View permissions on the named table as well as Create/Modify/Delete permissions on the named table's associated dataset to perform insert, update, and delete operations on writable tables. See Users and Roles in the Administration section for more information.
Note: Update is supported on PostGIS, Oracle, SQL Server, GeoPackage, and generic JDBC tables. It also supported on MapInfo native TAB and extended native TAB (NativeX) files. Named tables with composite primary keys are not writable.

ACL Authorization Flow

To update features in a named table by performing a query on a table using an MI SQL Update command string, the user (or the role they belong to) needs both EXECUTE and MODIFY permission on the Named table.

HTTP POST URL Format

The following format is used for HTTP POST requests:

HTTP POST: /FeatureService/tables/features.rep?
POST Data: [update=MI SQL query]
POST BODY: Content-Type:application/json {bound parameters}

Parameters

The {bound parameters} is a POST json body (Content-Type: application/json) for the MI SQL update query containing one or multiple parameters to be included. Null values are supported; however, a type is still required.

Note: The json in the POST is optional; it is only required if the SQL query uses bound parameters.

For more information on parameter types, see Request URL Data Types.

Parameter Type Required Description
rep String yes The representation to be returned. Supported representation is json.
update=MI SQL query String yes The update query to perform, in MI SQL format.

Returns

Returns the number of successfully updated features in a named table in the repository.

Example

Updates features for MyTable using a bound parameter.

http://hostname:port/rest/Spatial/FeatureService/tables/features.json?
update=UPDATE "/Samples/NamedTables/MyTable" where Column1=@stringParam
{
    "parameters" : [
       {
        "name" : "stringParam"
        "value" : "stringVal"
        }
    ]
}