REST API Proposal

JSON Data Structures

Page

{ 
  id: "",
  name: "",
  ownerId: "",
  layoutId: "",
  type: "",
  subPages: [ {..full page object..} ],
  regions: [
    {
      id: "",
      locked: true/false,
      regionWidgets: [
        {
          id: "",
          name: "",
          widgetId: "",
          collapsed: true/false,
          locked: true/false,
          chrome: true/false,
          preferences: [
            {
              name: "",
              value: ""
            } 
          ]
        }
      ]
    }
  ]
}

Notes on Page object:

REST Methods

As a general rule if you update an object that has nested objects as values (i.e. page), if you don't specify the key for the nested object (i.e. regions) then the regions would not be modified at all. If you do specify the key, then the values as part of that key will replace the entire sub-tree. Modifying sub items is much simpler by using the subresource paths under the parent object (i.e. pages/{id}/regions/...)

Pages

/pages - GET/POST - all pages that don't have parent pages
/pages/{id} - GET/PUT/DELETE - single page that doesn't have parent page
/pages/{id}/layout - GET - page layout object
/pages/{id}/regions - GET/POST - all regions
/pages/{id}/regions/{id} - GET/PUT/DELETE - single region
/pages/{id}/regions/{id}/position - GET/PUT - gets/sets the position the region is in the page
/pages/{id}/regions/{id}/regionwidgets - GET/POST - all the region widgets
/pages/{id}/regions/{id}/regionwidgets/{id} - GET/PUT/DELETE - single region widget
/pages/{id}/regions/{id}/regionwidgets/{id}/position - GET/PUT - gets/sets the position the regionwidget is in the page
/pages/{id}/regions/{id}/regionwidgets/{id}/widget - GET - widget object referenced by this region widget
/pages/{id}/regions/{id}/regionwidgets/{id}/preferences - GET/POST/PUT - preferences
/pages/{id}/subpages - GET/POST - all sub pages
/pages/{id}/subpages/{id} - GET/PUT/DELETE - single sub page (how many levels of sub pages are allowed? We can support unlimited but don't know if that's realistic)
/pages/{id}/subpages/{id}/layout - GET
/pages/{id}/subpages/{id}/regions - GET/POST
/pages/{id}/subpages/{id}/regions/{id} - GET/PUT/DELETE - single region
/pages/{id}/subpages/{id}/regions/{id}/position - GET/PUT - gets/sets the position the region is in the page
/pages/{id}/subpages/{id}/regions/{id}/regionwidgets - GET/POST - all the region widgets
/pages/{id}/subpages/{id}/regions/{id}/regionwidgets/{id} - GET/PUT/DELETE - single region widget
/pages/{id}/subpages/{id}/regions/{id}/regionwidgets/{id}/position - GET/PUT - gets/sets the position the regionwidget is in the page
/pages/{id}/subpages/{id}/regions/{id}/regionwidgets/{id}/widget - GET - widget object referenced by this region widget
/pages/{id}/subpages/{id}/regions/{id}/regionwidgets/{id}/preferences - GET/POST/PUT - preferences

RESTAPI (last edited 2013-11-07 00:22:39 by ChrisGeer)