Skip to content

Instantly share code, notes, and snippets.

@ivanvanderbyl
Last active December 11, 2015 19:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanvanderbyl/4646960 to your computer and use it in GitHub Desktop.
Save ivanvanderbyl/4646960 to your computer and use it in GitHub Desktop.
Kickfolio API V1 documentation

Kickfolio API

Our API allows you to create and manage your Apps, including uploading new Versions, removing Versions, and commenting on Versions.

All responses are in JSON format, and the URL structure generally tries to follow RFC-2616.

Authentication

All requests are authenticated using your authentication token, which is found on your account page when logged into the Kickfolio dashboard.

There are two ways to authenticate:

  1. Supplying an Authorization header (preferred)
  2. Supplying the auth_token parameter

Authenticating with headers

Header authentication follows the typical HTTP Authorization scheme of providing a BASE64 encoded hash to your authentication credentials. In this case the credentials are simply your authentication_token.

To generate the correct header simply apply a Base64 strict encoding (no linefeeds) to your authentication_token and send it as HTTP Basic auth: Authorization: Basic MY_BASE64_ENCODED_TOKEN. If your client library insists on supplying a password for sending basic auth, you can use X, which will be ignored on our end.

Ruby example:

encoded_token = Base64.strict_encode64(authentication_token)
request.header('Authorization', "Basic #{encoded_token}"

Parameter based authentication

The second option for authentication is supplying the auth_token parameter on the end of your query.

Here's an example:

curl http://kickfolio.com/api/apps?auth_token=MY_RAW_AUTH_TOKEN

Versioning

All API requests are subject to versioning, where the current version is always the latest version. It is strongly advised that you specify a specific version when requesting API resources. This is done by supplying an HTTP Accept e.g.

curl -H 'Accept: application/vnd.kickfolio.v1' http://kickfolio.com/api/apps

The versioning format is application/vnd.kickfolio.v1 where v1 is the version idenifier. At the time of writing the only version available is v1, however v2 is planned.

Errors

If you incorrectly access a resource the API will respond with an HTTP status code in the 4xx space or 5xx space depending on the cause. The body of the response will contain a JSON formatted error message based on the following schema:

{
  "message": "STRING - A human readable exmplanation of the problem",
  "code": "STRING - a unique string identifying the problem e.g. record_invalid",
  "errors": [ // Optional - only on record_invalid
    {
      "field" : "The property which was invalid",
      "resource" : "The name of the invalid resource",
      "message" : "The reason the field is invalid"
    }
  ]
}

Error codes and their meaning:

You can decide how to handle errors in your code based on the HTTP status code. These are some of the status codes we support in responses, and their meaning:

  • 200 OK Your request was successful.
  • 201 Created Your resource was created successfully.
  • 204 No Content Your resource was deleted successfully (Nothing to return, always contains an empty body).
  • 400 Bad Request One of your inputs was incorrectly encoded and could not be processed.
  • 401 Unauthorized You need to provide authentication credentials, or your credentials were rejected.
  • 422 Record is invalid. One of the values you supplied for an attribute did not pass validation. Please retry with another value.
  • 500 Internal Server Error We fucked up. We've been notified of the issue and our engineering team will fix the issue shortly. Please try again in a few hours.

Understanding the documentation

Our API makes extensive use of HTTP verbs to define endpoints, and instruct the server as to the nature of your request.

The HTTP verbs we support are:

  • GET
  • POST
  • PUT
  • DELETE

Each documented endpoint is written in a format similar to the following:

GET /api/resource/:identifier
PUT /api/apps/123

To access this these resources using the curl command line utility you would run this command:

$ curl https://kickfolio.com/api/apps/123 -X PUT -d '{"app" : {"name" : "New App Name"}}'

The :identifier component is a variable component which you should replace with the record identifer you need.

You can safely swap and replace any resource name mentioned in the docs with a another and access it in the same way. For example, all update actions are done using the PUT verb, and all creation actions are done using the POST verb.

POST /api/apps

Throughout the documentation we make reference to resources which may be nested under other resources, for example:

GET /api/apps/:app_id/versions/:id

In this case you can safely swap app_id with either the App public_key or App UUID formatted ID. For brevity this may not be mentioned in the documentation for every resource.

List all Apps GET /api/apps

  • GET /api/apps returns a collection of Apps.

Parameters

  • ids Optional Array: An array of IDs to filter the collection. Designed to work with Ember Data bulk loading.

Response

Status: 200 OK
{
  "apps": [
    {
      "id": "ae42f072-3f1a-11e2-92da-1231394268a3",
      "user_id": "57198bee-3f1a-11e2-92da-1231394268a3",
      "name": "Kickfolio",
      "public_key": "ABCD123",
      "bundle": "com.kickfolio.app",
      "default_to_landscape": false,
      "icon": "https://www.filepicker.io/api/file/SECRET",
      "device_type": "iPhone",
      "created_at": "2012-12-05T20:30:59Z",
      "updated_at": "2012-12-05T20:31:09Z",
      "versions": [
        "ae45868e-3f1a-11e2-92da-1231394268a3"
      ]
    }
  ]
}

Fetch a single App GET /api/apps/:id

  • GET /api/apps/:id returns a single App record.
  • GET /api/apps/:public_key returns a single App record.

Input

  • id Required 128bit UUID: App ID. Only required if public_key is not used.
  • public_key Optional String: App public key, used in place of an id for short urls.

Response

Status: 200 OK
{
  "app": {
    "id": "ae42f072-3f1a-11e2-92da-1231394268a3",
    "user_id": "57198bee-3f1a-11e2-92da-1231394268a3",
    "name": "Kickfolio",
    "public_key": "ABCD123",
    "bundle": "com.kickfolio.app",
    "default_to_landscape": false,
    "icon": "https://www.filepicker.io/api/file/SECRET",
    "device_type": "iPhone",
    "created_at": "2012-12-05T20:30:59Z",
    "updated_at": "2012-12-05T20:31:09Z",
    "versions": [
      "ae45868e-3f1a-11e2-92da-1231394268a3"
    ]
  }
}

Create a new App POST /api/apps

  • POST /api/apps creates a new App, returning the new record.

Input

  • name Required String: The name of your App.

Response

Status: 201 Created
{
  "app": {
    "id": "ae42f072-3f1a-11e2-92da-1231394268a3",
    "user_id": "57198bee-3f1a-11e2-92da-1231394268a3",
    "name": "Kickfolio",
    "public_key": "ABCD123",
    "bundle": "com.kickfolio.app",
    "default_to_landscape": false,
    "icon": "https://www.filepicker.io/api/file/SECRET",
    "device_type": "iPhone",
    "created_at": "2012-12-05T20:30:59Z",
    "updated_at": "2012-12-05T20:31:09Z",
    "versions": [
      "ae45868e-3f1a-11e2-92da-1231394268a3"
    ]
  }
}

Update an App PUT /api/apps/:id

  • PUT /api/apps/:id updates attributes of an existing app, returning result.
  • PUT /api/apps/:public_key updates attributes of an existing app, returning result.

Input

  • name Required String: The name of your App.

Response

Status: 200 OK
{
  "app": {
    "id": "ae42f072-3f1a-11e2-92da-1231394268a3",
    "user_id": "57198bee-3f1a-11e2-92da-1231394268a3",
    "name": "Kickfolio",
    "public_key": "ABCD123",
    "bundle": "com.kickfolio.app",
    "default_to_landscape": false,
    "icon": "https://www.filepicker.io/api/file/SECRET",
    "device_type": "iPhone",
    "created_at": "2012-12-05T20:30:59Z",
    "updated_at": "2013-1-20T18:31:09Z",
    "versions": [
      "ae45868e-3f1a-11e2-92da-1231394268a3"
    ]
  }
}

Delete an App DELETE /api/apps/:id

Warning: This is a destructive action. Through the API we provide no undo functionality.

  • DELETE /api/apps/:id deletes your App, returning nothing.
  • DELETE /api/apps/:public_key deletes your App, returning nothing.

Parameters

  • id Required String: The ID of the App to delete.

Response

Status: 204 No Content

List all Versions GET /api/versions

  • GET /api/versions returns a collection of all Versions on your account.
  • GET /api/apps/:app_id/versions returns a collection of Versions scoped to app_id

Parameters

  • ids Optional Array: An array of IDs to filter the collection. Designed to work with Ember Data bulk loading.

Response

Status: 200 OK
{
  "versions": [
    {
      "id": "c541ce63-2851-44c2-835f-10c9e55390f3",
      "app_id": "b197bce7-5eaa-4ab1-aae8-9c53f961b490",
      "state": "ready",
      "bundle_url": "https://www.filepicker.io/api/file/3JAgsZ0QSBl7vAhV79Pw",
      "version_string": "1.0",
      "default_image": "https://www.filepicker.io/api/file/cLpSGCypTz2Cs8NYTr6W",
      "default_image_landscape": null,
      "created_at": "2013-02-03T10:08:13Z",
      "updated_at": "2013-02-03T10:08:29Z",
      "comments": [

      ]
    }
  ]
}

Fetch a single Version GET /api/versions/:id

  • GET /api/versions/:id returns a single Version.
  • GET /api/apps/:app_id/versions/:id returns a single version, scoped by app_id. This will return a 404 if this version doesn't belong to app_id.

Parameters

  • id Required String: The ID of the Version you want to fetch.
  • app_id Optional String: The ID of the App to scope this query to.

Response

Status: 200 OK
{
  "version": {
    "id": "c541ce63-2851-44c2-835f-10c9e55390f3",
    "app_id": "b197bce7-5eaa-4ab1-aae8-9c53f961b490",
    "state": "ready",
    "bundle_url": "https://www.filepicker.io/api/file/3JAgsZ0QSBl7vAhV79Pw",
    "version_string": "1.0",
    "default_image": "https://www.filepicker.io/api/file/cLpSGCypTz2Cs8NYTr6W",
    "default_image_landscape": null,
    "created_at": "2013-02-03T10:08:13Z",
    "updated_at": "2013-02-03T10:08:29Z",
    "comments": [

    ]
  }
}

Create a Version POST /api/versions

  • POST /api/versions returns the newly created Version.
  • POST /api/apps/:app_id/versions returns the newly created Version.

Input

  • app_id Required String: The ID of the App this Version belongs to. This can be omitted from the payload if supplied in the URI.
  • bundle_url Required String: The URL to fetch your .app bundle from. This can be an valid URL which returns a ZIP file containing your App bundle.
  • version_string Optional String: The version string for this Version of your App. E.g. 1.2.4

Response

Status: 201 Created
{
  "version": {
    "id": "c541ce63-2851-44c2-835f-10c9e55390f3",
    "app_id": "b197bce7-5eaa-4ab1-aae8-9c53f961b490",
    "state": "pending",
    "bundle_url": "https://www.filepicker.io/api/file/3JAgsZ0QSBl7vAhV79Pw",
    "version_string": null,
    "default_image": null,
    "default_image_landscape": null,
    "created_at": "2013-02-03T10:08:13Z",
    "updated_at": "2013-02-03T10:08:13Z",
    "comments": [

    ]
  }
}

Update a Version PUT /api/versions/:id

  • PUT /api/versions/:id returns the updated representation of this Version.
  • PUT /api/apps/:app_id/versions/:id returns the updated representation of this Version.

Parameters

  • id Required String: The ID of the Version you want to update.

Inputs

  • app_id Required String: The ID of the App this Version belongs to. This can be omitted from the payload if supplied in the URI.
  • bundle_url Required String: The URL to fetch your .app bundle from. This can be an valid URL which returns a ZIP file containing your App bundle.
  • version_string Optional String: The version string for this Version of your App. E.g. 1.2.4

Response

Status: 200 OK
{
  "version": {
    "id": "c541ce63-2851-44c2-835f-10c9e55390f3",
    "app_id": "b197bce7-5eaa-4ab1-aae8-9c53f961b490",
    "state": "ready",
    "bundle_url": "https://www.filepicker.io/api/file/3JAgsZ0QSBl7vAhV79Pw",
    "version_string": "1.0",
    "default_image": "https://www.filepicker.io/api/file/cLpSGCypTz2Cs8NYTr6W",
    "default_image_landscape": null,
    "created_at": "2013-02-03T10:08:13Z",
    "updated_at": "2013-02-03T10:08:29Z",
    "comments": [

    ]
  }
}

Delete a Version DELETE /api/versions/:id

Warning: This is a destructive action. Through the API we provide no undo functionality.

  • DELETE /api/versions/:id deletes this Version, returning nothing.

Parameters

  • id Required String: The ID of the Version to delete.

Response

Status: 204 No Content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment