Skip to content
Snippets Groups Projects
Commit ca0e1a8d authored by Maël Méliani's avatar Maël Méliani
Browse files

Updated docs...

parent 5c8c1c3c
No related branches found
No related tags found
No related merge requests found
# MapServer REST API Resources
This section describes the REST configuration API.
It is in process of writing...
Nevertheless, you could refer to the GeoServer Rest API documentation cause MRA was designed to offer compatibility with this model.
You will also find few _docstrings_ by reading the code, especially the module `server.py` which defines the URL mapping infrastructure and HTTP methods used by the REST API.
### Workspaces
A workspace is a grouping of data stores and coverage stores.
A data store is a source of spatial data that is vector based.
It can be a file such as a _shapefile_ or a database such as _PostGIS_.
A data store contains one or more feature types which are vector based spatial resource.
In cases of a _shapefile_, the feature type is unique and corresponds to the data store.
In cases of a _PostGIS_ database, feature types corresponds to tables.
A coverage store is a source of spatial data that is raster based.
In current version, it can only be a _GeoTIFF_ file.
For this format file, the coverage is unique and corresponds to the coverage store.
Resource | Description
---------|------------
[**GET workspaces**](pages/workspaces.md#get-workspaces) | Returns a list containing workspaces.
[**POST workspaces**](pages/workspaces.md#post-workspaces) | Creates a new workspace.
[**GET workspaces/_{ws}_**](pages/workspaces.md#get-workspaces-ws) | Returns the given workspace.
[**GET workspaces/_{ws}_/datastores**](pages/datastores.md#get-datastores) | Returns a list containing data stores in the given workspace.
[**POST workspaces/_{ws}_/datastores**](pages/datastores.md#post-datastores) | Creates a new data store.
[**GET workspaces/_{ws}_/datastores/_{ds}_**](pages/datastores.md#get-datastores-ds) | Returns data store _{ds}_.
[**PUT workspaces/_{ws}_/datastores/_{ds}_**](pages/datastores.md#put-datastores-ds) | Modifies data store _{ds}_.
[**DELETE workspaces/_{ws}_/datastores/_{ds}_**](pages/datastores.md#delete-datastores-ds) | Deletes data store _{ds}_.
[**PUT workspaces/_{ws}_/datastores/_{ds}_/file._{extension}_**](pages/datastores.md#put-datastores-ds-file-extension) | Uploads a vector data file from a local source.
**GET workspaces/_{ws}_/datastores/_{ds}_/featuretypes** | Returns a list containing all feature types in selected data store.
**POST workspaces/_{ws}_/datastores/_{ds}_/featuretypes** | Creates a new feature type. It creates the associated layer by default.
**GET workspaces/_{ws}_/datastores/_{ds}_/featuretypes/_{ft}_** | Returns feature type _{ft}_.
**PUT workspaces/_{ws}_/datastores/_{ds}_/featuretypes/_{ft}_** | Modifies feature type _{ft}_.
**DELETE workspaces/_{ws}_/datastores/_{ds}_/featuretypes/_{ft}_** | Delete feture type _{ft}_.
**GET workspaces/_{ws}_/coveragestores** | Returns a list containing coverage stores in the given workspace.
**POST workspaces/_{ws}_/coveragetores** | Creates a new coverage store.
**GET workspaces/_{ws}_/coveragestores/_{cs}_** | Returns coverage store _{cs}_.
**PUT workspaces/_{ws}_/coveragestores/_{cs}_** | Modifies coverage store _{ds}_.
**DELETE workspaces/_{ws}_/coveragestores/_{cs}_** | Deletes coverage store _{ds}_.
**PUT workspaces/_{ws}_/coveragestores/_{cs}_/file._{extension}_** | Uploads a raster data file from a local source.
**GET workspaces/_{ws}_/coveragestores/_{cs}_/coverages** | Returns a list containing all coverages in selected coverage store.
**POST workspaces/_{ws}_/coveragestores/_{cs}_/coverages** | Creates a new coverage. It creates the associated layer by default.
**GET workspaces/_{ws}_/coveragestores/_{cs}_/coverages/_{c}_** | Returns coverage _{c}_.
**PUT workspaces/_{ws}_/coveragestores/_{cs}_/coverages/_{c}_** | Modifies coverage _{c}_.
**DELETE workspaces/_{ws}_/coveragestores/_{cs}_/coverages/_{c}_** | Deletes coverage _{c}_.
### Styles
A style describes how a resource (a feature type or a coverage) should be symbolized or rendered by a Web Map Service.
Styles are specified with SLD.
Resource | Description
---------|------------
**GET styles** | Returns a list containing all SLD styles.
**POST styles** | Creates a new SLD style.
**GET styles/_{s}_** | Returns style _{s}_.
**PUT styles/_{s}_** | Modifies style _{s}_.
**DELETE styles/_{s}_** | Deletes style _{s}_.
### Layers
A layer is a data resource that could be published by a OGC Web Service.
So a layer is the combination of data (feature type or coverage) plus styling (in case of OGC:WMS).
Resource | Description
---------|------------
**GET layers** | Returns a list containing all layers.
**POST layers** | Creates a new layer.
**GET layers/_{l}_** | Returns layer _{l}_.
**PUT layers/_{l}_** | Modifies layer _{l}_.
**DELETE layers/_{l}_** | Deletes layer _{l}_.
**GET layers/_{l}_/styles** | Returns a list containing all styles associated to layer _{l}_.
**DELETE layers/_{l}_/styles/_{s}_** | Removes style _{s}_ from layer _{l}_.
**GET layers/_{l}_/fields** | Returns a list containing all fields associated to layer _{l}_.
### Layer groups
A layergroup is a grouping of layers and styles that can be accessed as a single layer in a OGC:WMS GetMap request.
Resource | Description
---------|------------
**GET layergroups** | Returns a list containing all existing layer groups.
**POST layergroups** | Creates a new layer group.
**GET layergroups/_{lg}_** | Returns layer group _{lg}_.
**PUT layergroups/_{lg}_** | Modifies layer group _{lg}_.
**DELETE layergroups/_{lg}_** | Delete layer group _{lg}_.
### OGC Web Services
Controls the settings of OWS services (available for OGC:WMS, OGC:WFS and OGC:WCS).
Resource | Description
---------|------------
**GET service/[wms,wfs,wcs]/setting** | Returns the status of the main OGC service.
**PUT service/[wms,wfs,wcs]/setting** | Enables or disables the main OGC service.
### Fonts
Configures available fonts.
Resource | Description
---------|------------
**GET fonts** | Returns the list of available fonts.
**PUT fonts** | Uploads fonts from a local source.
TODO
\ No newline at end of file
## DataStores
A data store is a source of spatial data that is vector based.
### GET workspaces/{ws}/datastores
Returns a list containing data stores in workspace.
#### Resource URL
http://hostname/workspaces/{ws}/datastores.{extension}
#### Available formats
HTML (default value), JSON, XML.
#### Parameters
None
#### Exemple request
**GET http://hostname/workspaces/my_workspace/datastores.json**
**Status code:** 200 OK
**Response:**
{
"dataStores": [
{
"href": "http://hostname/workspaces/my_workspace/datastores/my_fisrt_datastore.json",
"name": "my_fisrt_datastore"
}
{
"href": "http://hostname/workspaces/my_workspace/datastores/my_second_datastore.json",
"name": "my_second_datastore"
}
]
}
### POST workspaces/{ws}/datastores
Creates a new data store in workspace.
#### Resource URL
http://hostname/workspaces/{ws}/datastores/{ds}.{extension}
#### Available formats
JSON, XML.
#### Parameters
None.
#### Example request
**POST http://hostname/workspaces/my_workspace/datastores.json**
**POST Content-type:** `application-json'
**POST data:**
{
"dataStore": {
"name": "pg_sample",
"enabled": true,
"connectionParameters": {
"host": "127.0.0.1",
"user": "postgres",
"database": "dbname",
"dbtype": "postgis",
"password": "postgres",
"port": "5432"
}
}
}
**Status code:** 201 OK
**Location:** http://hostname/workspaces/my_workspace/datastores/pg_sample.json
### GET workspaces/{ws}/datastores/{ds}
Returns data store {ds}.
#### Resource URL
http://hostname/workspaces/{ws}/datastores/{ds}.{extension}
#### Available formats
HTML (default value), JSON, XML.
#### Parameters
None
#### Example request
**GET http://hostname/workspaces/my_workspace/datastores/pg_sample.json
**Status code:** 200 OK
**Response:**
{
"dataStore": {
"name": "pg_sample",
"enabled": true,
"connectionParameters": {
"dbtype": "postgis",
"host": "127.0.0.1",
"port": "5432",
"database": "my_dbname",
"user": "postgres",
"password": "postgres"
},
"featureTypes": {
"href": "http://hostname/workspaces/my_workspace/datastores/pg_sample/featuretypes.json"
},
"workspace": {
"href": "http://hostname/workspaces/my_workspace.json",
"name": "my_workspace"
}
}
}
### PUT workspaces/{ws}/datastores/{ds}
Modifies data store {ds}.
#### Resource URL
http://hostname/workspaces/{ws}/datastores/{ds}.{extension}
#### Available formats
JSON, XML.
#### Parameters
None
#### Example request
**PUT http://hostname/workspaces/my_workspace/datastores/pg_sample.json
**PUT Content-type:** `application-json'
**Response:**
{
"dataStore": {
"name": "pg_sample",
"enabled": false,
"connectionParameters": {
"dbtype": "postgis",
"host": "127.0.0.1",
"port": "5432",
"database": "my_dbname",
"user": "mra",
"password": "foo"
},
}
}
**Status code:** 201 OK
**Location:** http://hostname/workspaces/my_workspace/datastores/pg_sample.json
### DELETE workspaces/{ws}/datastores/{ds}
Deletes data store {ds}.
#### Resource URL
http://hostname/workspaces/{ws}/datastores/{ds}.{extension}
#### Available formats
JSON, XML.
#### Parameters
None
#### Example request
**DELETE http://hostname/workspaces/my_workspace/datastores/pg_sample.json
**Status code:** 200 OK
### PUT workspaces/{ws}/datastores/{ds}/files.{extension}
Uploads a file from a local source and creates the data store.
File must be zipped.
#### Resource URL
http://hostname/workspaces/{ws}/datastores/{ds}/files.{extension}
#### Available formats
SHP (ShapeFile).
#### Parameters
None
#### Example request
**PUT http://hostname/workspaces/my_workspace/datastores/ne_110m_admin_0_countries/file.shp
**PUT Content-type:** `application-zip'
**PUT binary-data**
**Status code:** 200
TODO
\ No newline at end of file
TODO
\ No newline at end of file
TODO
\ No newline at end of file
TODO
\ No newline at end of file
TODO
\ No newline at end of file
## Workspaces
A workspace is a grouping of [data stores](datastores.md) and [coverages stores](coveragestores.md).
### GET workspaces
Returns a list containing all workspaces.
#### Resource URL
http://hostname/workspaces{.extension}
#### Available formats
HTML (default value), JSON, XML.
#### Parameters
None
#### Example request
**GET http://hostname/workspaces.json**
##### Response
**Status code:** 200 OK
{
"workspaces": [
{
"href": "http://hostname/workspaces/my_workspace.json",
"name": "sample"
}
]
}
### POST workspaces
Creates a new workspace.
#### Resource URL
http://hostname/workspaces{.extension}
#### Available formats
JSON, XML.
#### Parameters
None.
#### Example request
**POST http://hostname/workspaces.json**
**POST Content-type:** `application-json'
**POST data:**
{
"workspace":
{
"name": "another_workspace"
}
}
##### Response
**Status code:** 201 OK
**Location:** http://hostname/workspaces/my_workspace.json
### GET workspaces/{ws}
Returns workspace {ws}.
#### Resource URL
http://hostname/workspaces/{ws}.{extension}
#### Available formats
HTML (default value), JSON, XML.
#### Parameters
None
#### Example request
**GET http://hostname/workspaces/my_workspace.json**
##### Response
**Status code:** 200 OK
{
"workspace": {
"name": "my_workspace",
"dataStores": {
"href": "http://hostname/workspaces/my_workspace/datastores.json"
},
"coverageStores": {
"href": "http://hostname/workspaces/my_workspace/coveragestores.json"
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment