magiclabs/alchemy_cms — pull request #663 by tvdeyen (2014-11-24 14:55:51+00:00)
Title: Feature/json api namespace

Adds a new public JSON api under the `/api` namespace.

It offers 10 endpoints for fetching pages, elements and contents as JSON objects:

```
api_contents GET /api/contents(.:format) alchemy/api/contents#index {:format=>"json"}
api_content GET /api/contents/:id(.:format) alchemy/api/contents#show {:format=>"json"}
api_element_contents GET /api/elements/:element_id/contents(.:format) alchemy/api/contents#index {:format=>"json"}
api_element_content GET /api/elements/:element_id/contents/:name(.:format) alchemy/api/contents#show {:format=>"json"}
api_elements GET /api/elements(.:format) alchemy/api/elements#index {:format=>"json"}
api_element GET /api/elements/:id(.:format) alchemy/api/elements#show {:format=>"json"}
api_page_elements GET /api/pages/:page_id/elements(.:format) alchemy/api/elements#index {:format=>"json"}
api_page_named_elements GET /api/pages/:page_id/elements/:named(.:format) alchemy/api/elements#index {:format=>"json"}
api_pages GET /api/pages(.:format) alchemy/api/pages#index {:format=>"json"}
api_page GET /api/pages/*urlname(.:format) alchemy/api/pages#show {:format=>"json"}
api_preview_page GET /api/admin/pages/:id(.:format) alchemy/api/pages#show {:format=>"json"}
```

This also deprecates the old json API, without `/api` namespace. The old api will be removed at next mayor release and will log deprecation warnings as long as we receive the next milestone.