The "importtable" web service imports a CSV table data in the specified data source.
A typical URL is http://myserver.mycompany.com:8080/INTGeoServer/api/ds/{datasourcetype}/v1/sources/{datasource}/tables/import with the POST method.
where
datasourcetype: type of a datasource, i.e. mongo, s3, etc.
datasource: unique id of a datasource
The following parameters are available:
importoptions : a JSON array representing import options. The following parameters are available:
tableName: is the name of the table. This is an optional parameter. The default is the name of the file without extension.
overwrite indicates whether to override an existing table. If overwrite is false and a table already exists then an error will be thrown. This is an optional parameter. The default is false.
dataValuesRow: is the 1 based index of row where data first appears
delimiter is the character delimiter, if not specified then "," will be used (does not work with 'whitespace and tab' option)
headerDictionary is a JSON object representing column mappings. For each column mapping:
updatedHeader is the name of a column in a CSV file
index is the 1 based index of a column
type is the data typed of a column value: double, datetime, long, integer, etc.
unit is a unit of measurement of a column
file: a file containing a being imported well pumping. This is required parameter.
An example CSV file named IVAAP Table Data250 - Well1.csv is shown below:
Date,Oil,Gas,Water,nDays,cum Oil,OilPerc,GasPerc,WaterPerc
08/18/18,25,620,960,0,25,0.0156,0.3863,0.5981
08/19/18,337,3988,2271,1,362,0.0511,0.6046,0.3443
08/20/18,499,4711,2873,2,861,0.0617,0.5828,0.3554
08/21/18,89.76,505,909,3,950.76,0.0597,0.3358,0.6045
08/22/18,276.2,3217,891,4,1226.96,0.063,0.7338,0.2032
08/23/18,638.78,6341,1560,5,1865.74,0.0748,0.7425,0.1827
08/24/18,578.36,7406,1877,6,2444.1,0.0586,0.751,0.1903
08/25/18,1000,6038,3000,7,3444.1,0.0996,0.6015,0.2989
08/26/18,753,5778,2880,8,4197.1,0.08,0.614,0.306
08/27/18,1132,8410,3754,9,5329.1,0.0851,0.6325,0.2823
08/28/18,1236,9056,5031,10,6565.1,0.0807,0.591,0.3283
08/29/18,1398,11498,6960,11,7963.1,0.0704,0.5791,0.3505
08/30/18,987,8756,6140,12,8950.1,0.0621,0.5513,0.3866
08/31/18,1436,9193,6134,13,10386.1,0.0857,0.5484,0.3659
An example import is shown below (pass multipart/form-data as Content-Type):
importoptions:
{
"overwrite": true,
"dataValuesRow": 2,
"delimiter": ",",
"headerDictionary": [
{
"updatedHeader": "Date",
"index": 1,
"type": "DateTime",
"unit": ""
},
{
"updatedHeader": "Oil",
"index": 2,
"type": "Double",
"unit": "3"
},
{
"updatedHeader": "Gas",
"index": 3,
"type": "Double",
"unit": ""
},
{
"updatedHeader": "Water",
"index": 4,
"type": "Double",
"unit": ""
},
{
"updatedHeader": "nDays",
"index": 5,
"type": "Integer",
"unit": ""
},
{
"updatedHeader": "cum Oil",
"index": 6,
"type": "Double",
"unit": ""
},
{
"updatedHeader": "OilPerc",
"index": 7,
"type": "Double",
"unit": ""
},
{
"updatedHeader": "GasPerc",
"index": 8,
"type": "Double",
"unit": ""
},
{
"updatedHeader": "WaterPerc",
"index": 9,
"type": "Double",
"unit": ""
}
]
}
Here is an example response. This response has been formatted to improve readability.
{
"from": {
"actor": "akka://DefaultActorSystemControllerActorSystem:ImportTablesJsonActor:ImportTablesResponse for ImportTablesRequest:ImportTablesRequest{klass=AbstractTableImporter, sourceType=mongo, sourceName=c9db3458-6698-49d9-ae8f-f407ce26ae2e, numberOfUploadedFiles=1, file #0=UploadedFile{file=IVAAP Table Data250 - Well1-1.csv, directory=UPLOADDIR07ea6430-6d48-441a-abfe-6a3e417f8fda11577825137034318729, fileSize=816, checksum=2d8b7bdfe8ceb69c9a4083249ac1f378, mimeType=text/csv, originalFileName=IVAAP Table Data250 - Well1-1.csv, parameterName=file}, importOptions=TableImportParameters{tableName=null, overwrite=true, dataValuesRow=2, columnNameRow=0, columnUnitRow=0, columnValueRow=0, timeZone=null, nullValue=1.7976931348623157E308, columnParameters=[TableColumnImportParameters{columnIndex=0, columnName=Date, dataType=datetime, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=1, columnName=Oil, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=3}, TableColumnImportParameters{columnIndex=2, columnName=Gas, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=3, columnName=Water, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=4, columnName=nDays, dataType=integer, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=5, columnName=cum Oil, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=6, columnName=OilPerc, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=7, columnName=GasPerc, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}, TableColumnImportParameters{columnIndex=8, columnName=WaterPerc, dataType=double, dateFormat=null, timeFormat=null, dateTimeFormatSeparator= , timeFirst=false, unit=null}]}}"
},
"data": {
"files": [
{
"fileName": "IVAAP Table Data250 - Well1-1.csv",
"id": "adf2ca73-2eb4-4675-a230-678e23ab7d99",
"links": [
{
"rel": "self",
"relEntity": "v1/schema/int/table",
"href": "/ivaap/api/ds/mongo/v1/sources/c9db3458-6698-49d9-ae8f-f407ce26ae2e/tables/import",
"children": false,
"hasProjectEntityChildren": false,
"isProjectEntity": false
},
{
"rel": "Table",
"name": "Table",
"relEntity": "v1/schema/int/table",
"href": "/ivaap/api/ds/mongo/v1/sources/c9db3458-6698-49d9-ae8f-f407ce26ae2e/tables/adf2ca73-2eb4-4675-a230-678e23ab7d99",
"children": true,
"hasProjectEntityChildren": false,
"isProjectEntity": true
}
]
}
]
}
}
The fileName entry is the name of a being imported table file.
The id entry is a unique id of a table.
The links sections provides a HATEOAS link to the "Table Data Web Service (v3)" service.