API

Jumpstart Pro can provide API access to your application with API tokens and authentication already handled for you.

API Tokens

Every user in Jumpstart Pro can have multiple API tokens. They can create and revoke tokens on API section of their user settings.

Tokens keep track of the time they were last used so users can verify their integrations are working correctly and keep an eye on them.

Authentication

Authentication with the Jumpstart Pro API is as simple as passing in the Authorization header. We provide an example of this header on the API token page to make it easy for users to implement

An example Authorization header would look like the following:

GET /api/v1/me.json
Authorization: Bearer exampletoken

Controllers & Routes

API controllers are defined in app/controllers/api/v1/. We provide a /api/v1/me.json and /api/v1/teams.json endpoint out of the box. You can use these controllers as examples to base your API endpoints off of.

API controllers should inherit from Api::BaseController instead of ApplicationController. This enables API authentication. To skip authentication on an endpoint, add skip_before_action :authenticate_api_token! to your actions.

Authentication works with Devise so you can access current_user just like normal.

Since APIs don't have sessions, there is no current_team equivalent like in the main app. You can use nested resources in the API to scope things under teams if you want to separate them. For example: /api/v1/teams/2/projects/4.json.

JSON Responses

API controllers are configured to return JSON by default.

We use JBuilder by default to provide simple JSON templates that most users are already familiar with. To improve JBuilder performance, we have added the OJ gem for enhanced JSON performance.

We also recommend checking out the fast_jsonapi gem from Netflix if you'd like to use an alternative.