insertFeatures

Description

Inserts one or more records into a table. The body of the request contains the individual columns and values of the feature collection to be inserted. Each of these features contains zero or more column values. If a column is not specified that exists in the table, a null value will be inserted. A column value must be specified if it is part of a primary key whose value is not handled by the database (i.e. via an auto-increment constraint or sequence). To determine the primary key, examine the key definition in the describeTable response. The response contains the primary keys of features that were successfully inserted.

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 Access Control for Datasets in the Administration section for more information.
Note: Insert is supported on PostgreSQL/PostGIS, Oracle, SQL Server, SAP HANA, GeoPackage, and generic JDBC tables. The table must have a primary key or it will be considered a read-only table. Named tables with composite primary keys are not writable.

Messages

The following table lists the request and response messages for the insertFeatures operation.

Click on a message name to get more information about the message.

Message Description
InsertFeaturesRequest The request message for the insertFeatures operation.
InsertFeaturesResponse The response message for the insertFeatures operation.

Example

Example for inserting features into a table. The AttributeDefinitionList defines the columns of the table, and the FeatureList defines the values to be inserted:

						
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" 
		xmlns="http://www.mapinfo.com/midev/service/feature/v1" 
		xmlns:ns3="http://www.mapinfo.com/midev/service/featurecollection/v1" 
		xmlns:ns4=http://www.mapinfo.com/midev/service/geometries/v1"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<S:Header/>
		<S:Body>
			<InsertFeaturesRequest table="/MyTable" commitInterval="1">
				<ns3:FeatureCollection>
					<ns3:FeatureCollectionMetadata>
						<ns3:AttributeDefinitionList>
							<ns3:AttributeDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:ScalarAttributeDefinition" dataType="Double" name="Column1"/>
							<ns3:AttributeDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:GeometryAttributeDefinition" srsName="epsg:4267" dataType="Geometry" name="SP_GEOMETRY"/>
						</ns3:AttributeDefinitionList>
					</ns3:FeatureCollectionMetadata>
					<ns3:FeatureList>
						<ns3:Feature>
							<ns3:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:DoubleValue">
								<ns3:Value>123.456</ns3:Value>
							</ns3:AttributeValue>
							<ns3:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns3:GeometryValue">
								<ns4:FeatureGeometry xsi:type="ns4:Point" srsName="epsg:4326">
									<ns4:Pos>
										<ns4:X>-72</ns4:X>
										<ns4:Y>42</ns4:Y>
									</ns4:Pos>
								</ns4:FeatureGeometry>
							</ns3:AttributeValue>
						</ns3:Feature>
					</ns3:FeatureList>
				</ns3:FeatureCollection>
			</InsertFeaturesRequest>
		</S:Body>
	</S:Envelope>