Insert Features Using SQL
Description
Inserts features in a table by performing a query on a table using an MI SQL Insert command string. See the MapInfo SQL Language Reference for detailed information on MapInfo SQL functions.
The body JSON representation of the geometries is in GeoJSON format. For more information on GeoJSON, see geojson.org/geojson-spec.html.
ACL Authorization Flow
To insert features in a named table by performing a query on a table using an MI SQL Insert command string, the user (or the role they belong to) needs both EXECUTE and CREATE 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: [insert=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 insert query containing one or multiple parameters to be included. Null values are supported; however, a type is still required.
For information on the parameter types listed below, see Request URL Data Types.
Parameter | Type | Required | Description |
---|---|---|---|
rep | String | yes | The representation to be returned. Supported representation is json. |
insert=MI SQL query | String | yes | The insert query to perform, in MI SQL format. |
Returns
Returns the number of successfully inserted features in a named table in the repository. For
native and NativeX TAB files, a SuccessfulInserts
response is
returned instead that indicates the number of successful rows inserted.
Examples
Inserts features from MyTable using a bound parameter:
http://hostname:port/rest/Spatial/FeatureService/tables/features.json?
insert= INSERT INTO “/WORLDTABLE”(MI_PRINX, COUNTRY, CAPITAL, CONTINENT, OBJ)
VALUES (257,'Bahrain', 'Manama', 'Asia', @geomParam)
{
"parameters": [{
"name": "geomParam",
"value": {
"type": "Point",
"coordinates": [-72, 42],
"crs": {
"type": "name",
"properties": {
"name": "epsg:4269"
}
}
}
}]
}