Refinery CMS Rest API extension
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
config
db/migrate
lib
script
spec
tasks
.gitignore
.rbenv-gemsets
.ruby-version
.travis.yml
Gemfile
LICENSE
Rakefile
readme.md
refinerycms_api.gemspec

readme.md

Refinery CMS Api

Build Status

This extension allows you to use a Rest API with Refinery CMS 3.0 and later.

TODO

  • Check Abilities
  • Fix specs

Installation

Simply put this in the Gemfile of your Refinery application:

gem 'refinerycms-api', github: 'refinerycms-contrib/refinerycms-api', branch: 'master'

Then run bundle install to install it.

Generate and run migrations

$ rails g refinery:api  # Generate initializer
$ rake db:migrate

Then restart your server.

Usage

Create an API Token for your user

$ rake refinery_api:user:api_token:generate EMAIL=refinery@example.org

Pages

$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/pages
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/pages/1
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/pages/new

$ curl -X POST --header "X-Refinery-Token: YOUR_API_TOKEN" "http://localhost:3000/api/v1/pages" -d 'page[title]=test'
$ curl -X PUT --header "X-Refinery-Token: YOUR_API_TOKEN" "http://localhost:3000/api/v1/pages/1" -d 'page[title]=test2'
$ curl -X DELETE -H "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/pages/1

Images

$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/images
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/images/1
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/images/new

Resources

$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/resources
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/resources/1
$ curl --header "X-Refinery-Token: YOUR_API_TOKEN" http://localhost:3000/api/v1/resources/new

Contributing

Please see the contributing.md file for instructions.