Category Archives: play


this plugin can be used to generate the boiler plate code to access a database and provide a rest api for it that offers create read update delete. I use Slick for the database access.

from the demo blog project for example

GET /tables/blog ( with optional query params sortBy and direction)

GET /tables/blog// (this queries database where = . You can also use optional query params sortBy and direction)

GET /tables/blog/

POST /tables/blog

PUT /tables/blog

DELETE /tables/blog/:blog_id

Note if GET / queries a timestamp it should be passes a long value not text representation

slick,controller and routes generated from single configuration file.

You have to create the database as well as configure it in application.conf

There are sample test projects under directory

while a fuller project

which is deployed on Heroku here


you tube demo

This is a Play Framework application that stores markdown pages in a Sqlite database accessed using REST services.

The intention of the application is that it is deployed as a WAR file running alongside another web application. You can create notes about your application as you develop as well as keep those notes beside the application. I was inspired by poor documentation of webservices in a WSDL when I’m after are use cases for a webservice or something akin to a hello world that makes the usage of the service clear. This is also why I hooked in the SoapUI libraries so that I could import a WSDL and generated sample requests and responses. Also with a number of security caveats it is possible to also hit a “TryIt” button and call the webservice.

There is no accounting for multi user access to this application or security of any kind. What’s needed and not done yet is a facility to export the markdown documents in the Sqlite database and generate static pages.

I’m using the excellent javascript library to actually do the presentation work here.


I’ve checked in a demo Sqlite database with the code btw

clone the code, then

./activator run

Visit from a browser (tested with firefox and chrome)

deploying as a war

./activator war

then copy file plodder-1.0-SNAPSHOT.war to your application then make sure its context path is /plodder. There is an example application cxfdemo that uses plodder here.

create a page

Once running, I am assuming using activator run rather than as a WAR for now go to

From the top menu select “edit”

The next page shows the path that the page would be saved to, use /hello and the box on the left is where the markdown source goes. To create a new page hit the create button and to update an existing page use save. These 2 buttons equate to POST and PUT a page of markdown while there is a get to.

run time environment


this accesses a home page for your application. If it doesn’t exist it creates a list of pages. There is no ability to edit pages now.

play rest swagger and some google charts

I’ve got an article published in Linux Format issue 214 Rest,Swagger and Play with a demo application using Google Charts to display a timeseries overtime. There are 2 demos, one tracking the share price of BT compared to FTSE 100 and the temperature difference between London and Darlington.

The share price information uses Yahoo’s YQL to query a source of stock quotes

The temperature information is available from Open Weather Map API

The database for Play implementation is Sqlite. The play implementation is 2.4 as 2.5 was too fresh to support Swagger at the time. I wanted to show how easy it is to add Swagger annotations to a simple interface.

Finally as it’s Play it was easy to deploy this to Heroku. Albeit changing the database from Sqlite to Postgres. See

and the 2 charts

Source code is available here

weather chart
stock chart

blogdog, add foreign key constraint

I updated blogdog so that it shows sqlite within play framework using a foreign key. The trick is to get slick when it initialises to add the correct PRAGMA for sqlite. This is the value in application.conf

slick.dbs.default.db.connectionInitSql=”PRAGMA foreign_keys = ON”

then ensure db is created correctly (from evolutions 1.sql)


note that foreign key cannot be a string value

full source is here