Skip to content

REST API example URLs

jumpinjackie edited this page Apr 1, 2014 · 10 revisions

NOTE: For the most comprehensive updated documentation, consult the integrated and interactive API reference that is included in your mapguide-rest installation

The REST API provides REST-ful access to various parts of the MapGuide API. Below are some example URLs to give you an idea of what is capable with the REST API.

mapguide-rest also provides HTML representations of the various APIs allowing you to "explore" all aspects of the REST API.

  • Site Repository: http://localhost/mapguide/rest/library/list.html
  • FDO Provider Registry: http://localhost/mapguide/rest/providers.html
  • Coordinate System Catalog: http://localhost/mapguide/rest/coordsys/categories.html

NOTE: For any PUT and DELETE requests shown below, you can use POST with X-HTTP-Method-Override set to PUT or DELETE if your web server does not allow the use of PUT and DELETE.

Resource Service APIs

Getting the resource content of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/content

Getting the resource header of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/header

List the resource data of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/data

List the resources that reference Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/references

Feature Service APIs

List spatial contexts of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/spatialcontexts

List schema names of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/schemas

Describe Feature Schema (SHP_Schema) of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/schema/SHP_Schema

List class names under the Feature Schema (SHP_Schema) of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/classes/SHP_Schema

Describe Class Definition (SHP_Schema:Parcels) of Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/classdef/SHP_Schema/Parcels

List registered FDO providers

GET http://localhost/mapguide/rest/providers

Describe the capabilities of the SDF provider

GET http://localhost/mapguide/rest/providers/OSGeo.SDF/capabilities

List the available data stores for the SQL Server provider based on partial connection parameters (specified in the query string)

GET http://localhost/mapguide/rest/providers/OSGeo.SQLServerSpatial/datastores?Service=(local)\SQLEXPRESS&Username=myuser&Password=mypass

Get the available connection values for the SDF connection property (ReadOnly)

GET http://localhost/mapguide/rest/providers/OSGeo.SDF/connectvalues/ReadOnly

Feature Service APIs - Querying

Return first 1000 features from (SHP_Schema:Parcels) in Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/features/SHP_Schema/Parcels?maxfeatures=1000

Return parcels whose owner starts with "SCHMITT" (note the %25 to escape the % wildcard)

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/features/SHP_Schema/Parcels?filter=RNAME LIKE 'SCHMITT%25'

Return first 1000 features with restricted list of properties from (SHP_Schema:Parcels) in Library://Samples/Sheboygan/Data/Parcels.FeatureSource

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/features/SHP_Schema/Parcels?properties=Autogenerated_SDF_ID,RNAME,SHPGEOM&maxfeatures=1000

Return first 1000 features from (SHP_Schema:Parcels) in Library://Samples/Sheboygan/Data/Parcels.FeatureSource transformed to WGS84.PseudoMercator (the Google/Bing/OSM coordinate syste,)

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Data/Parcels.FeatureSource/features/SHP_Schema/Parcels?maxfeatures=1000&transformto=WGS84.PseudoMercator

Rendering Service APIs

Render a 1024x768 PNG image of Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition at (-87.73, 43.74) at scale of 12000 with 96 DPI

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Maps/Sheboygan.MapDefinition/image.png?x=-87.73&y=43.74&scale=12000&width=1024&height=768&dpi=96

Mapping Service APIs

Get the icon for Library://Samples/Sheboygan/Layers/Islands.LayerDefinition at scale 8000 for the 1st theme category of the area style (Area = 3) in PNG format

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/Layers/Islands.LayerDefinition/legend/8000/3/0/icon.png

Tile APIs

Get tile from group "Base Layer Group" at (col: 0, row: 1) at scale index 7 of Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition

GET http://localhost/mapguide/rest/library/Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition/tile/Base%20Layer%20Group/7/0/1

NOTE: 304 HTTP caching will be applied if the REST extension can physically access the tile caches of the MapGuide Server and the REST extension configuration correctly points to the root directory where MapGuide Server creates its tile caches.

Coordinate System APIs

List coordinate system categories

GET http://localhost/mapguide/rest/coordsys/categories

List coordinate systems under category of Australia

GET http://localhost/mapguide/rest/coordsys/category/Australia

Get the EPSG code of the coordinate system (mentor code: LL84)

GET http://localhost/mapguide/rest/coordsys/mentor/LL84/epsg

Get the WKT of the coordinate system (mentor code: LL84)

GET http://localhost/mapguide/rest/coordsys/mentor/LL84/wkt

Get the mentor code of the coordinate system (EPSG:4326)

GET http://localhost/mapguide/rest/coordsys/epsg/4326/mentor

Get the WKT of the coordinate system (EPSG:4326)

GET http://localhost/mapguide/rest/coordsys/epsg/4326/wkt

Site APIs

The following requests require a session id created from an Administrator account. Anonymous MapGuide session ids are denied access.

Get current site status

GET http://localhost/mapguide/rest/site/status

Get current site version

GET http://localhost/mapguide/rest/site/version

List user groups

GET http://localhost/mapguide/rest/site/groups

List roles for WfsUser

GET http://localhost/mapguide/rest/site/user/WfsUser/roles

List groups for WfsUser

GET http://localhost/mapguide/rest/site/user/WfsUser/groups

List users under group "Everyone"

GET http://localhost/mapguide/rest/site/groups/Everyone/users