Changes between Version 3 and Version 4 of Future/RESTfulWebServices
- Timestamp:
- Mar 19, 2008, 9:57:25 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Future/RESTfulWebServices
v3 v4 172 172 }}} 173 173 174 To get a list of the Spatial Contexts the following might work:174 To get a list of the Spatial Contexts you would call: 175 175 176 176 {{{ … … 218 218 }}} 219 219 220 ''' (jb) QUESTION: Does this make sense? Shouldn't a DELETE on the class delete the class itself?''' 221 220 222 To 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: 221 223 … … 237 239 In 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? 238 240 241 ''' (jb) QUESTION: Say what?''' 242 239 243 [[BR]] 240 244 [[BR]] … … 249 253 250 254 The first thing we need is the ability to create a Map resource / !MgMap object. 251 252 {{{253 POST254 .../library/MyStuff/MyMap.MapDefinition/createmap255 256 Optional Parameters:257 name=<mapname>258 }}}259 260 {{{261 POST262 .../session/<uglysesssionid>/createmap263 264 Required Parameters:265 name=<mapname>266 srs=<srswkt>267 envelope=x1,y1,x2,y2268 }}}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'''271 255 272 256 {{{ … … 277 261 MapDefinition=http://example.org/mapguide/rest/library/MyStuff/MyMap.MapDefinition 278 262 }}} 279 280 and281 263 282 264 {{{ … … 289 271 }}} 290 272 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] 273 And for server-assigned resource naming (e.g. need a unique resource to ensure no collisions): 274 275 {{{ 276 POST 277 .../services/createmap 278 Required Parameters: 279 session=<uglysesssionid> 280 name=<mapname/ 281 srs=<srswkt> 282 envelope=x1,y1,x2,y2 283 }}} 284 285 All 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 287 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. 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 {{{ 292 GET 293 .../session/<uglysesssionid>/MyMap.Map/image 298 294 299 295 Optional Parameters: 300 296 <Big list of them from RenderingService::RenderMap> 301 302 POST 303 .../session/<uglysesssionid>/MyMap.Map/image.png [or .jpg or .gif] 297 }}} 298 299 {{{ 300 POST 301 .../session/<uglysesssionid>/MyMap.Map/image 304 302 305 303 Optional Parameters: 306 304 <Big list of them from RenderingService::RenderMap> 307 305 }}} 306 308 307 The 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 311 310 So 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 {{{ 313 GET 314 .../session/<uglysesssionid>/MyMap.Map/overlayimage 315 315 316 316 Optional Parameters: 317 317 <List of them from RenderingService::RenderDynamicOverlay> 318 319 POST 320 .../session/<uglysesssionid>/MyMap.Map/overlayimage.png [or .jpg or .gif] 318 }}} 319 320 {{{ 321 POST 322 .../session/<uglysesssionid>/MyMap.Map/overlayimage 321 323 322 324 Optional Parameters: 323 325 <List of them from RenderingService::RenderDynamicOverlay> 324 326 }}} 327 328 {{{ 325 329 GET 326 330 .../library/MyStuff/MyMap.MapDefinition/basetileimage/<baselayergroupname>/<scaleindex>/<tilecolumn>,<tilerow> 327 331 328 332 }}} 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 334 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. 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 339 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. These could be in JSON or XML. 340 341 {{{ 342 GET 343 .../session/<uglysesssionid>/MyMap.Map 344 345 GET 346 .../session/<uglysesssionid>/MyMap.Map/layers 347 348 GET 349 .../session/<uglysesssionid>/MyMap.Map/layers/<layername> 350 351 GET 352 .../session/<uglysesssionid>/MyMap.Map/layergroups 353 354 GET 355 .../session/<uglysesssionid>/MyMap.Map/layergroups/<layergroupname> 356 }}} 357 358 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 (these would return PNG8, PNG24, GIF, or JPG images) 359 360 {{{ 361 GET 362 .../library/MyStuff/MyLayer.LayerDefinition/legendicon/<mapscale>/<geomtype>/<themecat> 353 363 354 364 Optional Parameters: … … 356 366 height=<desiredimageheight> 357 367 }}} 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 369 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 which could be exposed RESTfully as: 370 371 {{{ 372 GET 373 .../session/<uglysesssionid>/MyMap.Map/features 362 374 363 375 Optional (but highly recommended) Parameters: … … 367 379 maxFeatures=<maxdesiredfeatures> 368 380 }}} 381 369 382 More 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 370 386 [[BR]] 371 387 [[BR]] … … 373 389 [[BR]] 374 390 [[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 378 394 == 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. 395 We need some way for an application to create a session. We can do that with a POST to /session as follows. 396 380 397 {{{ 381 398 POST 382 399 .../session 383 400 }}} 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 404 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>/ along with a 201 header. 405 406 388 407 = Security, Authentication, and Access Control = 389 TBD 408 409 This 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