Changes between Version 3 and Version 4 of Future/RESTfulWebServices


Ignore:
Timestamp:
Mar 19, 2008, 9:57:25 PM (16 years ago)
Author:
jbirch
Comment:

Enough for tonight...

Legend:

Unmodified
Added
Removed
Modified
  • Future/RESTfulWebServices

    v3 v4  
    172172}}}
    173173
    174 To get a list of the Spatial Contexts the following might work:
     174To get a list of the Spatial Contexts you would call:
    175175
    176176{{{
     
    218218}}}
    219219
     220''' (jb) QUESTION:  Does this make sense?  Shouldn't a DELETE on the class delete the class itself?'''
     221
    220222To support Insert and Update operations we'll need to rely on the HTTP POST (insert) and PUT (update) methods. These operations can be defined as follows:
    221223
     
    237239In both cases the HTTP request envelope must contain a property value collection that defines either the properties of the newly created feature or the properties to be updated and their new values. The collection could be in either JSON or XML format and an open question whether the URI should specify the expected type?
    238240
     241''' (jb) QUESTION:  Say what?'''
     242
    239243[[BR]]
    240244[[BR]]
     
    249253
    250254The first thing we need is the ability to create a Map resource / !MgMap object.
    251 
    252 {{{
    253 POST
    254 .../library/MyStuff/MyMap.MapDefinition/createmap
    255 
    256 Optional Parameters:
    257    name=<mapname>
    258 }}}
    259 
    260 {{{
    261 POST
    262 .../session/<uglysesssionid>/createmap
    263 
    264 Required Parameters:
    265    name=<mapname>
    266    srs=<srswkt>
    267    envelope=x1,y1,x2,y2
    268 }}}
    269 
    270 ''' (jb) ALTERNATIVE:  Unless you are going to be storing the map in those locations, I would prefer to see something like the following'''
    271255
    272256{{{
     
    277261  MapDefinition=http://example.org/mapguide/rest/library/MyStuff/MyMap.MapDefinition
    278262}}}
    279 
    280 and
    281263
    282264{{{
     
    289271}}}
    290272
    291 ''' (jb) ALTERNATIVE ENDS'''
    292 
    293 The first creates a new map from the Map Definition resource identified in the URI. The later creates an empty map with the specified name, coordinate system, and extent. Now that we have a map, we need some way to render the map (with and without selection), the dynamic overlay (with and without selection), and base map tiles.
    294 
    295 {{{
    296 GET
    297 .../session/<uglysesssionid>/MyMap.Map/image.png [or .jpg or .gif]
     273And for server-assigned resource naming (e.g. need a unique resource to ensure no collisions):
     274
     275{{{
     276POST
     277.../services/createmap
     278Required Parameters:
     279  session=<uglysesssionid>
     280  name=<mapname/
     281  srs=<srswkt>
     282  envelope=x1,y1,x2,y2
     283}}}
     284
     285All of these, of course, would return a "201 Created" response code, and the would reply with the elements specified in section 10 of the HTTP 1.1 spec.  This includes a pointer to the created resource, which is particularly important in the latter case.
     286
     287Now that we have a map, we need some way to render the map (with and without selection), the dynamic overlay (with and without selection), and base map tiles.  These rendering calls support media types of JPG, PNG, and GIF, and we need some way of specifying PNG24 or PNG8.
     288
     289''' (jb) How to do this with no separate MIME type? Do we need to use a format override?  Are there browsers that need to have an extension for the image?  And again, we run into not knowing what resource are available under the meta "MyMap.Map" resource; we need a way to enumerate the options.'''
     290
     291{{{
     292GET
     293.../session/<uglysesssionid>/MyMap.Map/image
    298294
    299295Optional Parameters:
    300296   <Big list of them from RenderingService::RenderMap>
    301 
    302 POST
    303 .../session/<uglysesssionid>/MyMap.Map/image.png [or .jpg or .gif]
     297}}}
     298
     299{{{
     300POST
     301.../session/<uglysesssionid>/MyMap.Map/image
    304302
    305303Optional Parameters:
    306304   <Big list of them from RenderingService::RenderMap>
    307305}}}
     306
    308307The first one would render a single image of the map (all visible layers including base map) using the current state of the map from the session. The second provides a way to update the map state stored in the session and return a new image in a single shot. In the HTTP POST method case the post data is expected to contain a list of commands that would alter the map state, e.g. turn on these layers, turn off those layers, set the new center to this, etc.
    309 [[BR]]
    310 [[BR]]
     308
     309
    311310So what about support for tiled maps with dynamic overlays.
    312 {{{
    313 GET
    314 .../session/<uglysesssionid>/MyMap.Map/overlayimage.png [or .jpg or .gif]
     311
     312{{{
     313GET
     314.../session/<uglysesssionid>/MyMap.Map/overlayimage
    315315
    316316Optional Parameters:
    317317   <List of them from RenderingService::RenderDynamicOverlay>
    318 
    319 POST
    320 .../session/<uglysesssionid>/MyMap.Map/overlayimage.png [or .jpg or .gif]
     318}}}
     319
     320{{{
     321POST
     322.../session/<uglysesssionid>/MyMap.Map/overlayimage
    321323
    322324Optional Parameters:
    323325   <List of them from RenderingService::RenderDynamicOverlay>
    324 
     326}}}
     327
     328{{{
    325329GET
    326330.../library/MyStuff/MyMap.MapDefinition/basetileimage/<baselayergroupname>/<scaleindex>/<tilecolumn>,<tilerow>
    327331
    328332}}}
    329 As with the normal map image delivery, the HTTP POST form of /overlayimage can include a set of commands for altering the state of the map  object prior to rendering and returning the image. Note that base tile image access works based on a the Map Definition, not the runtime Map. That is because !MapGuide caches base map tiles based on the groups within a Map Definition, not on a per user basis.
    330 [[BR]]
    331 [[BR]]
    332 To build a cool client application, we need information about the map, the layers, the layer groups, etc. The next set of operations is designed to return an informational representation of map that can be used to create a compelling user interface.
    333 {{{
    334 GET
    335 .../session/<uglysesssionid>/MyMap.Map.xml [or .json]
    336 
    337 GET
    338 .../session/<uglysesssionid>/MyMap.Map/layers.xml [or .json]
    339 
    340 GET
    341 .../session/<uglysesssionid>/MyMap.Map/layers/<layername>.xml [or .json]
    342 
    343 GET
    344 .../session/<uglysesssionid>/MyMap.Map/layergroups.xml [or .json]
    345 
    346 GET
    347 .../session/<uglysesssionid>/MyMap.Map/layergroups/<layergroupname>.xml [or .json]
    348 }}}
    349 The output of these needs some thought, but basically would encapsulate the properties found in the !MgMap, !MgLayer, and !MgLayerGroup objects in the Web API. To complete this we need to include some way to generate a icons for the legend.
    350 {{{
    351 GET
    352 .../library/MyStuff/MyLayer.LayerDefinition/legendicon/<mapscale>/<geomtype>/<themecat>.png [or .jpg or .gif]
     333
     334As with the normal map image delivery, the HTTP POST form of /overlayimage can include a set of commands for altering the state of the map object prior to rendering and returning the image. Note that base tile image access works based on a the Map Definition, not the runtime Map. That is because !MapGuide caches base map tiles based on the groups within a Map Definition, not on a per user basis.
     335
     336''' (jb) COMMENT:  For the /basetileimage calls, it is critical that we support all standard HTTP caching headers.  This means checking state of the underlying tile; does this require new APIs for the tile service to return properties of the existing tile when not generating fresh? '''
     337
     338
     339To build a cool client application, we need information about the map, the layers, the layer groups, etc. The next set of operations is designed to return an informational representation of map that can be used to create a compelling user interface.  These could be in JSON or XML.
     340
     341{{{
     342GET
     343.../session/<uglysesssionid>/MyMap.Map
     344
     345GET
     346.../session/<uglysesssionid>/MyMap.Map/layers
     347
     348GET
     349.../session/<uglysesssionid>/MyMap.Map/layers/<layername>
     350
     351GET
     352.../session/<uglysesssionid>/MyMap.Map/layergroups
     353
     354GET
     355.../session/<uglysesssionid>/MyMap.Map/layergroups/<layergroupname>
     356}}}
     357
     358The output of these needs some thought, but basically would encapsulate the properties found in the !MgMap, !MgLayer, and !MgLayerGroup objects in the Web API. To complete this we need to include some way to generate a icons for the legend (these would return PNG8, PNG24, GIF, or JPG images)
     359
     360{{{
     361GET
     362.../library/MyStuff/MyLayer.LayerDefinition/legendicon/<mapscale>/<geomtype>/<themecat>
    353363
    354364Optional Parameters:
     
    356366   height=<desiredimageheight>
    357367}}}
    358 Now of course no mapping client is complete without some way to interact with and query the features displayed on the map. The !MapGuide Web API includes the !MgRenderingService::!QueryFeatures APIs for this and I propose the following RESTful representation:
    359 {{{
    360 GET
    361 .../session/<uglysesssionid>/MyMap.Map/features.xml [or .json]
     368
     369Now of course no mapping client is complete without some way to interact with and query the features displayed on the map. The !MapGuide Web API includes the !MgRenderingService::!QueryFeatures APIs which could be exposed RESTfully as:
     370
     371{{{
     372GET
     373.../session/<uglysesssionid>/MyMap.Map/features
    362374
    363375Optional (but highly recommended) Parameters:
     
    367379   maxFeatures=<maxdesiredfeatures>
    368380}}}
     381
    369382More parameters are probably needed here, but you get the idea.
     383
     384''' (jb) COMMENT:  Some services have suggested storing the spatial filter feature as its own resource, and just refering to it in the GET.  This would prevent problems with overflowing the GET max size'''
     385
    370386[[BR]]
    371387[[BR]]
     
    373389[[BR]]
    374390[[BR]]
    375 [[BR]]
    376 '''Note:''' Within all of this the handling of selection is bugging me. We need to think about that some more and figure out what is the right way of handling selection RESTfully.
    377 [[BR]]
     391''' (rb) Note: Within all of this the handling of selection is bugging me. We need to think about that some more and figure out what is the right way of handling selection RESTfully. '''
     392[[BR]]
     393
    378394== Other Necessary Stuff ==
    379 We need some way for an application to create a session. By simply support a POST to /session as follows we can meet that requirement.
     395We need some way for an application to create a session. We can do that with a POST to /session as follows.
     396
    380397{{{
    381398POST
    382399.../session
    383400}}}
    384 There is no required HTTP request envelope and the return envelope would simply contain the newly created session URI, e.g. http://somemgsite.org/mapguide/rest/session/<newuglysessionid>/.
    385 [[BR]]
    386 [[BR]]
    387 [[BR]]
     401
     402
     403
     404There is no required HTTP request envelope and the return envelope would simply contain the newly created session URI, e.g. http://somemgsite.org/mapguide/rest/session/<newuglysessionid>/ along with a 201 header.
     405
     406
    388407= Security, Authentication, and Access Control =
    389 TBD
     408
     409This is all handled by native HTTP authentication.  If generic service endpoints are required to create users and associate users with roles/groups, then these can be created as required.  Access control is handled through modification of the resource headers.
     410