The Supplejack API is a Rails mountable engine that provides functionality to store, index and retrieve metadata via an API. It also includes an API dashboard for monitoring API key activity and setting query throttle rates.
This wiki provides a guide on how to create and configure your API as well as an introduction to the rest of the Supplejack project.
Before starting you should check that you have all the dependencies installed.
Once that is complete we strongly recommend using the Supplejack template to create your app. This template will create a new app which includes the Supplejack API engine and then step through the configuration options.
For details about how to install Supplejack Template, see Install & Setup
Once the install is complete you should have a working API. The next step is to configure your schema so that you can configure the fields that are stored/returned by your API.
Setup a custom record model from your API [OPTIONAL]
If you want to use a custom SupplejackApi::Record model, you can define a supplejack_api.rb initializer file and define the following block:
SupplejackApi.setup do |config| config.record_class = YourCustomClass config.preview_record_class = YourPreviewCustomClass end
Log Record Metric Data
By default, Supplejack will log a history of Records that have been viewed in searches and individually, if you do not want this functionality simply set
config.log_metrics = false in
SupplejackApi.setup do |config| config.log_metrics = false end
By setting a custom class you will be able to do for example: YourCustomClass.custom_find(
Generate API User keys
From the Worker’s project root, Run the console.
Create a user.
> SupplejackApi::User.create(email: 'email@example.com', name: 'Your Name', username: 'your_username') => #<SupplejackApi::User _id: 53d58681f694195642000002, created_at: 2014-07-27 23:08:49 UTC, updated_at: 2014-07-27 23:08:49 UTC, email: "firstname.lastname@example.org", encrypted_password: nil, name: "Your Name", username: "your_username", sign_in_count: nil, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, authentication_token: "JmVe15z2BSHDwaVsjMvA", daily_requests: 0, monthly_requests: 0, max_requests: 10000, role: "developer", daily_activity: nil, daily_activity_stored: true> > SupplejackApi::User.last.authentication_token => "RhymLHa9xRQGU8gyAYXP"