ClearPress Framework

REST

ClearPress supports working in a RESTful fashion. That is to say there is a very systematic naming scheme for addressing entities and supporting the operations usually required:

The URL scheme looks something like this:

Create
POST to http://server/application/entity
Read
GET from http://server/application/entity/id
Update
POST to http://server/application/entity/id
Delete
POST to http://server/application/entity/id;delete
Entity list
GET http://server/application/entity/
Add entity form
GET http://server/application/entity/id;add
Edit entity
GET http://server/application/entity/id;edit

On the whole this is fine - default responses are in text/html and that's great. Occasionally we want to use XML or JSON representations - simple!

Entity list in XML
GET http://server/application/entity.xml
Entity in JSON
GET http://server/application/entity/id.js
Entity image
GET http://server/application/entity/id.png
Of course these do require a little work behind the scenes, like writing templates to support JSON or XML responses, or adjusting a view to return PNG images, but most of the annoying stuff should be taken care of for you.