Skip to content
Ryan Mark edited this page Jan 19, 2016 · 22 revisions

Autotune has a Web API built for the front-end javascript app. It can be used by other applications to do anything you're able to do with the Web UI.

Intro

The API endpoints exactly map to the application URLs you see when navigating the application. The API is entirely JSON-based. All data is returned as JSON, all request data must be JSON-formatted.

All requests must set the Accept header:

Accept: application/json

All POST, PUT, PATCH requests must set the Content-Type header:

Content-Type: application/json

Authentication

Autotune requires a simple bearer token in your HTTP headers for API access:

Authorization: API-KEY auth=ABC123

You can create a machine account for accessing the API with the create_superuser rake task:

$ rake create_superuser[[email protected]]

You can grab the API key of an existing user with the get_api_key rake task:

$ rake get_api_key[[email protected]]

In production, API requests must go over HTTPS. The API is not designed to be secure over unencrypted connections.

Errors

The API will emit appropriate HTTP status codes if there are errors: 4xx errors if the problem is with the request, 500 if there is an error on the server, 2xx for success.

Errors that result from a bad request (4xx) will include a JSON payload with an errors attribute:

{ "error": "Some message" }

These error messages are intended to be presented directly to the user.

Projects

List GET /projects

Return a list of projects, sorted reverse chronologically by last update time.

API query options (all are optional)

/projects
  ?page=1            # return x page of results
  &per_page=15       # return x number of results per page
  &theme=abc123      # return projects that are using this theme name (slug of theme)
  &blueprint_title=1 # return projects that are using this blueprint (ID of blueprint)
  &pub_status=draft  # return only draft or only published projects (draft or published)
  &search=foo        # return projects with names and/or authors matching this string

Response format

Blueprints

TK