Blazer JSON API

An extension to Blazer to enable exposing your queries as JSON via API so it can be consumed outside of Blazer by your application.

Features

  • Powered by SQL Author APIs quickly using Blazers IDE. Particular useful for private/internal APIs that fall outside of your standard API endpoints
  • No deploy APIs Expermental APIs can be authored quickly via Blazer without the need to do a deploy
  • Flexible structure JSON response structure can be controlled directly in SQL by using a column naming convention (double underscore denotes a nesting by default, but can be overridden)
  • Security You'll likely want to lock down API access so APIs are authenticated separately to standard Blazer authentication using HTTP basic authentication to avoid granding everyone with access to Blazer also access to your APIs.
  • URL parameters URL parameters are also supported built on Blazers query variables meaning the APIs can be highly dynamic and flexible
  • Pagination Pagination can be controlled using query variables in combination with limits and offsets
  • Multiple data sources Blazer supports multiple datasources meaning you can potentially build APIs that access beyond the applications database (e.g. ElasticSearch, Google BigQuery, Salesforce)

Installation

Follow the installation steps described to get Blazer up and running. Then, add this line to your application's Gemfile:

gem 'blazer_json_api'

And then execute:

$ bundle

And mount the engine in your config/routes.rb:

mount BlazerJsonAPI, at: 'blazer-api'

Configure authentication in an initializer as follows (e.g. in initializers/blazer_json_api.rb)

BlazerJsonAPI::Config.username = <api-username>
BlazerJsonAPI::Config.password = <api-password>

Usage

Create queries as normal via Blazer and use the query identifier to render the JSON via the mounted location.

e.g. /blazer-api/queries/1-all-users

Example queries

TODO

Contributing

TODO

License

The gem is available as open source under the terms of the MIT License.