GeoServer Importer Extension - Tasks
The Importer extension gives a GeoServer administrator an alternate, more-streamlined method for uploading and configuring new layers. The tasks endpoint controls individual tasks within an import job. The importer extension is an optional install and may not be available on all deployments of GeoServer
Version: 1.0.0
BasePath:/geoserver/rest
All rights reserved
http://apache.org/licenses/LICENSE-2.0.html
Access
[ Jump to Models ]
Table of Contents
Up
delete /imports/{importId}/tasks/{taskId}
Remove task with id {taskId} within import with id {importId} (deleteTask)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Responses
200
OK
Up
get /imports/{importId}/tasks/{taskId}
Retrieve task with id {taskId} within import with id {importId} (getTask)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
{
"data" : {
"type" : "remote"
},
"updateMode" : "CREATE",
"errorMessage" : "errorMessage",
"progress" : "progress",
"messages" : "",
"id" : "id",
"href" : "href",
"state" : "PENDING",
"transformChain" : {
"transforms" : "",
"type" : "type"
},
"layer" : {
"originalName" : "originalName",
"nativeName" : "nativeName",
"srs" : "srs",
"bbox" : {
"miny" : "miny",
"minx" : "minx",
"crs" : "crs",
"maxy" : "maxy",
"maxx" : "maxx"
},
"name" : "name",
"description" : "description",
"attributes" : "",
"style" : {
"filename" : "filename",
"languageVersion" : {
"version" : "version"
},
"name" : "name",
"format" : "format",
"href" : "href"
},
"href" : "href",
"abstract" : "abstract",
"title" : "title"
},
"target" : {
"href" : "href",
"store" : "{}"
}
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Task
Up
get /imports/{importId}/tasks/{taskId}/layer
Retrieve the layer of a task with id {taskId} within import with id {importId} (getTaskLayer)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
{
"originalName" : "originalName",
"nativeName" : "nativeName",
"srs" : "srs",
"bbox" : {
"miny" : "miny",
"minx" : "minx",
"crs" : "crs",
"maxy" : "maxy",
"maxx" : "maxx"
},
"name" : "name",
"description" : "description",
"attributes" : "",
"style" : {
"filename" : "filename",
"languageVersion" : {
"version" : "version"
},
"name" : "name",
"format" : "format",
"href" : "href"
},
"href" : "href",
"abstract" : "abstract",
"title" : "title"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Layer
Up
get /imports/{importId}/tasks/{taskId}/progress
Retrieve the current state and import progress of a task with id {taskId} within import with id {importId} (getTaskProgress)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Return type
Example data
Content-Type: application/json
{
"total" : "total",
"progress" : "progress",
"state" : "PENDING",
"message" : "message"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/htm
Responses
200
OK
Progress
Up
get /imports/{importId}/tasks/{taskId}/target
Retrieve the store of a task with id {taskId} within import with id {importId} (getTaskTarget)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
{
"href" : "href",
"store" : "{}"
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Store
Up
get /imports/{importId}/tasks
Retrieve all tasks for import with id {importId} (getTasks)
Path parameters
importId (required)
Path Parameter — The ID of the import
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: none
Return type
Example data
Content-Type: application/json
"{\n \"tasks\": [\n {\n \"id\": 0,\n \"href\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/0\",\n \"state\": \"READY\"\n }\n ]\n }\n"
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Tasks
Example data
Content-Type: application/json
{
"tasks": [
{
"id": 0,
"href": "http://localhost:8080/geoserver/rest/imports/2/tasks/0",
"state": "READY"
}
]
}
Up
post /imports/{importId}/tasks
Create a new task (postTask)
A new task can be created by issuing a POST to imports//tasks as a "Content-type: multipart/form-data" multipart encoded data as defined by RFC 2388. One or more file can be uploaded this way, and a task will be created for importing them. In case the file being uploaded is a zip file, it will be unzipped on the server side and treated as a directory of files.
Alternatively, a new task can be created by issuing a POST as a "Content-type: application/x-www-form-urlencoded" form url encoded data containing a url paramerter with the location of the uploaded file.
Path parameters
importId (required)
Path Parameter — The ID of the import
Consumes
This API call consumes the following media types via the request header:
multipart/form-data
application/x-www-form-urlencoded
Request body
Body Parameter — The task to create or modify
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: none
Return type
Example data
Content-Type: application/json
"{\n \"task\": {\n \"id\": 1,\n \"href\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/1\",\n \"state\": \"READY\",\n \"updateMode\": \"CREATE\",\n \"data\": {\n \"type\": \"file\",\n \"format\": \"Shapefile\",\n \"href\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/1/data\",\n \"file\": \"bugsites.shp\"\n },\n \"target\": {\n \"href\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/1/target\",\n \"dataStore\": {\n \"name\": \"shapes\",\n \"type\": \"PostGIS\"\n }\n },\n \"progress\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/1/progress\",\n \"layer\": {\n \"name\": \"bugsites\",\n \"href\": \"http://localhost:8080/geoserver/rest/imports/2/tasks/1/layer\"\n },\n \"transformChain\": {\n \"type\": \"vector\",\n \"transforms\": []\n }\n }\n }\n"
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/htm
Responses
201
Created
Task
Example data
Content-Type: application/json
{
"task": {
"id": 1,
"href": "http://localhost:8080/geoserver/rest/imports/2/tasks/1",
"state": "READY",
"updateMode": "CREATE",
"data": {
"type": "file",
"format": "Shapefile",
"href": "http://localhost:8080/geoserver/rest/imports/2/tasks/1/data",
"file": "bugsites.shp"
},
"target": {
"href": "http://localhost:8080/geoserver/rest/imports/2/tasks/1/target",
"dataStore": {
"name": "shapes",
"type": "PostGIS"
}
},
"progress": "http://localhost:8080/geoserver/rest/imports/2/tasks/1/progress",
"layer": {
"name": "bugsites",
"href": "http://localhost:8080/geoserver/rest/imports/2/tasks/1/layer"
},
"transformChain": {
"type": "vector",
"transforms": []
}
}
}
Up
put /imports/{importId}/tasks/{taskId}
Modify task with id {taskId} within import with id {importId} (putTask)
A PUT request over an existing task can be used to update its representation. The representation can be partial, and just contains the elements that need to be updated.
The updateMode of a task normally starts as "CREATE", that is, create the target resource if missing. Other possible values are "REPLACE", that is, delete the existing features in the target layer and replace them with the task source ones, or "APPEND", to just add the features from the task source into an existing layer.
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Consumes
This API call consumes the following media types via the request header:
application/json
text/json
Request body
Body Parameter — The task to create or modify
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
{
"data" : {
"type" : "remote"
},
"updateMode" : "CREATE",
"errorMessage" : "errorMessage",
"progress" : "progress",
"messages" : "",
"id" : "id",
"href" : "href",
"state" : "PENDING",
"transformChain" : {
"transforms" : "",
"type" : "type"
},
"layer" : {
"originalName" : "originalName",
"nativeName" : "nativeName",
"srs" : "srs",
"bbox" : {
"miny" : "miny",
"minx" : "minx",
"crs" : "crs",
"maxy" : "maxy",
"maxx" : "maxx"
},
"name" : "name",
"description" : "description",
"attributes" : "",
"style" : {
"filename" : "filename",
"languageVersion" : {
"version" : "version"
},
"name" : "name",
"format" : "format",
"href" : "href"
},
"href" : "href",
"abstract" : "abstract",
"title" : "title"
},
"target" : {
"href" : "href",
"store" : "{}"
}
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Task
Up
put /imports/{importId}/tasks/{filename}
Create a new task (putTaskFile)
A new task can be created by issuing a PUT containing the raw file content to this endpoint. The name of the uploaded file will be {filename}. The location of the uploaded file will be the top level directory associated with the import, or the "uploads" directory in the data directory if no directory is associated with the current import.
Path parameters
importId (required)
Path Parameter — The ID of the import
filename (required)
Path Parameter — The filename
Consumes
This API call consumes the following media types via the request header:
Request body
Body Parameter — The file contents to upload.
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
""
Responses
201
Created
Tasks
Up
put /imports/{importId}/tasks/{taskId}/layer
Modify the target layer for a task with id {taskId} within import with id {importId} (putTaskLayer)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Consumes
This API call consumes the following media types via the request header:
application/json
text/json
Request body
layerBody
Layer (required)
Body Parameter — The layer to modify
Query parameters
expand (optional)
Query Parameter — What level to expand the response object to. Can be "self" (expand only the response object and its immediate children), "all" (expand all children), "none" (don't include any children), or a nonnegative integer, indicating the depth of children to expand to. default: self
Return type
Example data
Content-Type: application/json
{
"data" : {
"type" : "remote"
},
"updateMode" : "CREATE",
"errorMessage" : "errorMessage",
"progress" : "progress",
"messages" : "",
"id" : "id",
"href" : "href",
"state" : "PENDING",
"transformChain" : {
"transforms" : "",
"type" : "type"
},
"layer" : {
"originalName" : "originalName",
"nativeName" : "nativeName",
"srs" : "srs",
"bbox" : {
"miny" : "miny",
"minx" : "minx",
"crs" : "crs",
"maxy" : "maxy",
"maxx" : "maxx"
},
"name" : "name",
"description" : "description",
"attributes" : "",
"style" : {
"filename" : "filename",
"languageVersion" : {
"version" : "version"
},
"name" : "name",
"format" : "format",
"href" : "href"
},
"href" : "href",
"abstract" : "abstract",
"title" : "title"
},
"target" : {
"href" : "href",
"store" : "{}"
}
}
Produces
This API call produces the following media types according to the request header;
the media type will be conveyed by the response header.
application/json
text/html
Responses
200
OK
Task
Up
put /imports/{importId}/tasks/{taskId}/target
Modify the target store for a task with id {taskId} within import with id {importId} (putTaskTarget)
Path parameters
importId (required)
Path Parameter — The ID of the import
taskId (required)
Path Parameter — The ID of the task
Consumes
This API call consumes the following media types via the request header:
application/json
text/json
Request body
targetBody
Store (required)
Body Parameter — The store to modify
Responses
200
OK
[ Jump to Methods ]
Table of Contents
Bbox
- Bbox
Data
- data
FeatureType
- featureType
FeatureType_inner
-
Layer
- layer
Message
- message
Messages
- messages
Progress
- progress
Store
- store
Style
- style
Style_languageVersion
-
Task
- task
Tasks
- tasks
Transform
- transform
TransformChain
- transformChain
Transforms
- transforms
messages
-
A spatially referenced bounding box.
minx (optional)
miny (optional)
maxx (optional)
maxy (optional)
crs (optional)
String The WKT representation of the CRS.
A data representation. Paramaters vary depending on the type.
type (optional)
remote
file
directory
mosaic
database
table
A feature type attribute.
name (optional)
String The name of the attribute
binding (optional)
String The java class representing the type of the attribute
A layer
name (optional)
href (optional)
String URL to the importer layer endpoint
title (optional)
abstract (optional)
description (optional)
originalName (optional)
String The original name of the layer. This may be different from the name if this name already exists in geoserver.
nativeName (optional)
String The name of the underlying resource
srs (optional)
bbox (optional)
attributes (optional)
style (optional)
A message about the import data.
Task progress
progress (optional)
String Number of operations completed
total (optional)
String Total number of operations
state (optional)
PENDING
READY
RUNNING
NO_CRS
NO_BOUNDS
NO_FORMAT
BAD_FORMAT
ERROR
CANCELED
COMPLETE
message (optional)
String Error message. Only shown if state is "ERROR"
A store
href (optional)
String URL to the task target endpoint
store (optional)
Object JSON representation of the store
A layer style
name (optional)
href (optional)
String URL to the importer layer style endpoint
format (optional)
languageVersion (optional)
filename (optional)
version (optional)
String Version of style format
An import task
id (optional)
href (optional)
String URL to the task endpoint
state (optional)
PENDING
READY
RUNNING
NO_CRS
NO_BOUNDS
NO_FORMAT
BAD_FORMAT
ERROR
CANCELED
COMPLETE
updateMode (optional)
String Update mode of the task.
CREATE
REPLACE
APPEND
UPDATE
data (optional)
target (optional)
progress (optional)
String URL to the progress endpoint for this task
layer (optional)
errorMessage (optional)
String Any error messages for the task, concatenated.
transformChain (optional)
messages (optional)
A data transform applied to the import data.
type (optional)
String The name of the transform
href (optional)
String URL to the transform endpoint
A chain of tranform operations to apply during the import process
type (optional)
String The type of transforms in the chain. One of "vector" or "raster"
transforms (optional)
level (optional)
String Level of the log message.
messsage (optional)