TAPAS API

About the API

TAPAS now has a public API. This allows you read-only access to most attributes, such as frames, uploads, users, projects and institutions.

Write access is also provided for uploads specifically, so uploads can be made from the API, which might be useful for automating them.

Code examples for listing the projects and making an upload are available here: https://github.com/willfurnell/tapas-api-demos.

You can browse the API to see exactly what you can do https://starserver.thelangton.org.uk/tapas/api/v1/. You’ll need to log in separately on the API site to test it.

Generating an API Key/Auth Token

Note: The API Key is called AuthToken internally and therefore may be referred to this.

To use the API you need to generate an API key. This is tied to your user account and provides a way of letting the API know who you are, and what you are authorized to access.

To do this log in to TAPAS. Then click your username in the top right hand corner. This will bring you to your user page. On your user page, click ‘Generate API Key’. The page will refresh and show your API key, which will be something similar to

6ee8ac72a45d5f9cebd9e1ffacaf6df85f2c2449

You can now use this in the Authorization header in your requests eg.

Authorization: Token YOUR_API_KEY_GOES_HERE

API Endpoints

For all API endpoints, id is the primary key - unique identifier - of the object and url is the direct URL to the object.

upload

Has the following fields:
  • ‘id’ - Integer
  • ‘url’ - URL
  • ‘name’ - String
  • ‘uploaded_by’ - URL
  • ‘uploaded_time’ - Integer
  • ‘notes’ - String
  • ‘latitude’ - Real
  • ‘longitude’ - Real
  • ‘latitude_end’ - Real
  • ‘longitude_end’ - Real
  • ‘project’ - URL

Note: When uploading a file, via POST you CANNOT use these fields as is.

You need to use the following fields:
  • ‘name’ - String
  • ‘project’ - Integer project ID
You can also use the following fields:
  • ‘notes’ - String
  • ‘latitude’ - Real
  • ‘longitude’ - Real
  • ‘latitude_end’ - Real
  • ‘longitude_end’ - Real

An example for uploading files can be found here: https://github.com/willfurnell/tapas-api-demos/blob/master/uploading-zip-file.py

user

Has the following fields:
  • ‘id’ - Integer
  • ‘url’ - URL
  • ‘username’ - String

institution

Has the following fields:
  • ‘id’ - Integer
  • ‘url’ - URL
  • ‘name’ - String
  • ‘latitude’ - Real
  • ‘longitude’ - Real
  • ‘manager’ - URL
  • ‘description’ - String

project

Has the following fields:
  • ‘id’ - Integer
  • ‘url’ - URL
  • ‘name’ - String
  • ‘description’ - String
  • ‘require_dsc’ - Boolean (1/0)
  • ‘confidential_data’ - Boolean
  • ‘require_login’ - Boolean
  • ‘manager’ - URL

frame

Has the following fields:
  • ‘id’ - Integer
  • ‘url’ - URL
  • ‘name’ - String
  • ‘detector’ - String
  • ‘capture_time’ - Integer
  • ‘alpha’ - Integer
  • ‘beta’ - Integer
  • ‘gamma’ - Integer
  • ‘proton’ - Integer
  • ‘muon’ - Integer
  • ‘other’ - Integer
  • ‘processed’ - Boolean (1/0)
  • ‘flagged’ - Boolean
  • ‘upload_id’ - URL
  • ‘project’ - URL

lucidrun

Has the following fields:
  • ‘id’ - Integer
  • ‘run_start’ - String
  • ‘ptr’ - String
  • ‘url’ - URL, may be ommitted when POSTing

lucidfile

Has the following fields:
  • ‘id’ - Integer
  • ‘start_time’ - Real
  • ‘end_time’ - Real
  • ‘config’ - Integer
  • ‘run’ - URL
  • ‘url’ - URL, may be omitted when POSTing

lucidframe

Has the following fields:
  • ‘id’ - Integer
  • ‘capture_time’ - Real
  • ‘detector’ - Integer, 0,1,2,3
  • ‘alpha’ - Integer
  • ‘beta’ - Integer
  • ‘gamma’ - Integer
  • ‘proton’ - Integer
  • ‘muon’ - Integer
  • ‘other’ - Integer
  • ‘processed’ - Boolean (1/0)
  • ‘file’ - URL
  • ‘latitude’ - Real
  • ‘longitude’ - Real