Skip to content
Multi-Project API System
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
lib/tasks
spec
.gitignore
Gemfile
Gemfile.lock
README.md
README_DEV.md
Rakefile
config.ru
database.yml
hydra.png

README.md

hydra-grape

A multi-project API system.

Features:

  • create REST API using specific endpoints (called collections)
  • create group of API (called projects)
  • simple auth using tokens
  • built using Grape, a Mongo DB is required

hydra

Examples

  • Endpoint to create a new project:
curl -X POST 'http://localhost:3000/api/v1/projects' -H 'Content-Type: application/json' --data '{"name":"MyProject","code":"prj","url":"https://www.google.com"}'
  • Endpoint to create a collection (using a project id):
curl -X POST 'http://localhost:3000/api/v1/collections/58b1dc2bf571550470276cc2' -H 'Content-Type: application/json' --data '{"name":"authors","singular":"author","columns":{"first_name":"String","last_name":"String","age":"Integer"}}'
  • Endpoint to create a new item (using a project code and a collection name):
curl -X POST 'http://localhost:3000/api/v1/items/prj_authors' -H 'Content-Type: application/json' --data '{"data":{"first_name":"John","last_name":"Doe","age":"25"}}'
  • Endpoint to list entries:
curl 'http://localhost:3000/api/v1/items/prj_authors'

Setup

  • Prepare database:
rake db:mongoid:drop
rake db:mongoid:create_indexes

Dev / More examples

  • See specific document: here
You can’t perform that action at this time.