Skip to content

API Endpoints

Ben Serrette edited this page Aug 23, 2019 · 32 revisions

General Notes

Return a 403 if the user performing the action does not have access to a particular data set

All endpoints should accept auth-token headers that can be validated by the authenticate-token auth endpoint

Errors (e.g. 403, 500, etc) should be accompanied by a json response body including an "error message" field

NOTE: Endpoints marked with * are not yet implemented


Authentication endpoints (Login)

/api/auth/authenticate-token

  • Request: -Headers: -Body:
{"username":"xxxxx"}

/api/auth/permissions


Query Builder endpoints (Data API)

/api/data/publications-async

/api/data/publications-sync

          {
            dataset: "wos", // or "mag" etc
            filters: [
                {
                    field: 'year',
                    value: '2007',
                    operation: "AND" //or OR etc
                },
                {
                    field: 'author',
                    value: 'Smith',
                    operation: "" 
                },
                ...
            ],
            output: [
                {
                    type: 'single',
                    field: 'paper_id'
                },
                {
                    type: 'single',
                    field: 'year'
                },
                {
                    type: 'single',
                    field: 'authors'
                },
                {
                    type: 'network',
                    field: 'citations',
                    degree: '2'
                }
            ]
        }

RAC endpoints

These are all in the backend of the Interface Repo https://github.com/iuni-cadre/cadre-interface

/qi-api/user-jobs

  • List Jobs for the current user

/rac-api/packages/run-package

  • Runs a package by sending a job to the SQS queue

  • Request:

      { package_id: xxx, output_filename: [xxx, xxx, ...] }
    
  • Response:

      { job_id: xxx, job_status: xxx }
    
  • Error:

      { error_message: "Descriptive Message about why it failed to run" }
    

/rac-api/get-packages

  • List All packages

  • NOTE: Actual response depends on how we decide to handle the database schema

  • Request:

      { limit: xxx, page: xxx, order: xxx, search: xxx }
    
  • Response:

      [
          {
               package_id: "xxxxx",
               name: "xxxxx",
               author: "xxxx",
               created_date: "2019-07-16 10:51:26",
               tools: ["tool 1", "tool 2"],
               input_files: ["/dataset.csv"]
          },
          ....
      ]
    

/rac-api/new-notebook/<username>

  • Create a new notebook server for a given user
  • Proxy for the Kubernates endpoint

/rac-api/notebook-status/<username>

  • Gets the status of a user's notebook
  • Proxy for the Kubernates endpoint

/rac-api/get-new-notebook-token/<username>

  • Get a new notebook token for a given user
  • Proxy for the Kubernates endpoint

/api/rac/jobs/user/{user} *

  • List jobs for specific user

/api/rac/jobs/{job_id} *

  • Get metadata including status for a specific job

/api/rac/packages/new *

  • Create a new package

/api/rac/teams *

  • List teams for current user

/api/rac/teams/{team_id} *

  • Get metadata for specific team

/api/rac/teams/new *

  • Create a new team

/api/rac/teams/user-add/<user_id> *

  • 403 if the user does not have access to the datasets used by the team
  • 404 if the user doesn't exist

/api/rac/teams/user-remove/<user_id> *

/api/rac/datasets *

  • List datasets that the current user has access to

/api/rac/notebooks *

  • List current user's available notebooks (for user and team)

/api/rac/notebooks/user/<user_id>*

  • Get specific user's notebooks

/api/rac/notebooks/team/<team_id> *

  • Get notebooks for a specific team

/api/rac/notebooks/{notebook_id}*

  • Get metadata for a specific notebook

/api/rac/data-assets/ *

  • List data assets (query results, etc) for the current user

/api/rac/data-assets/{data-set} *

  • Get list of assets for a specific data set (wos, mag, etc)

/api/rac/data-assets/{asset-id}/move-to-notebook/{notebook-id} *

  • Copy a data asset to a specific notebook.
  • Updates list of datasets that the notebook contains
  • 403 if notebook does not have access to the data set

/api/rac/institutions/ *

  • List all institutions

/api/rac/institutions/{institution} *

  • Get metadata for specific institution, including which datasets they have access to.