Get a demo

Get in touch

Prefer using email? Write us at hello@moveshelf.com

Developer – Using the API

    Search Knowledge Base
Getting started
  • Setting up the environment
  • Setting up a GitHub repository
  • Setting up the Moveshelf API
  • Recording - Intro to Moveshelf API
  • Using the API
  • Moveshelf API documentation
  • Configuration and authentication
  • Use built-in functions
  • Examples provided by Moveshelf
  • Importing data
  • Create subject
  • Import subject metadata
  • Create session
  • Import session metadata
  • Create trial
  • Upload data files
  • Create interactive reports
  • Querying data
  • Retrieve a filtered subset of subjects
  • Retrieve a filtered subset of sessions
  • Retrieve a subject
  • Retrieve subject metadata
  • Retrieve session
  • Retrieve session metadata
  • Export metadata to Excel
  • Retrieve trials
  • Retrieve data files
  • Deleting data
  • Delete a subject
  • Delete multiple subjects
  • Delete a session
  • Delete a trial
  • Delete all trials within a condition
  • Delete a data file
  • Example scripts
  • Public repository
  • Download data
  • Download large data sets
  • Batch upload data
  • Pre vs post intervention data export
  • Extending the Moveshelf API
  • Extending the Moveshelf API
  • Configure and authenticate the Moveshelf API, and find a link to the complete API documentation.



    Moveshelf API documentation
    While this page covers a variety of examples of basic and advanced API usage, you can find a complete overview of the functions that are available in the Moveshelf API here.


     

    Configuration and authentication
    In this section we will explain how you can import the Moveshelf API into your processing script to securely interact with Moveshelf.
    Prerequisites
    Before implementing this example, ensure that you have performed all necessary setup steps. In particular, you should have:
    Configure the Moveshelf API
    Add the following lines of code to your processing script to use the Moveshelf API:
    import os, sys, json
    parent_folder = os.path.dirname(os.path.dirname(__file__))
    sys.path.append(parent_folder)
    from moveshelf_api.api import MoveshelfApi
    from moveshelf_api import util
    
    ## Setup the API
    # Load config
    personal_config = os.path.join(parent_folder, "mvshlf-config.json")
    if not os.path.isfile(personal_config):
        raise FileNotFoundError(
            f"Configuration file '{personal_config}' is missing.\n"
            "Ensure the file exists with the correct name and path."
        )
    
    with open(personal_config, "r") as config_file:
        data = json.load(config_file)
    
    custom_timeout = <nSeconds> # timeout (integer) for HTTP calls. Defaults to 120 if undefined
    
    api = MoveshelfApi(
        api_key_file=os.path.join(parent_folder, data["apiKeyFileName"]),
        api_url=data["apiUrl"],
        timeout=custom_timeout,
    )


     

    Use built-in functions
    In this section we will show how you can use built-in functions of the Moveshelf API.
    Prerequisites
    Before implementing this example, ensure that your processing script includes all necessary setup steps. In particular, you should have:
    Use built-in functions of the Moveshelf API
    In this example we are going to use a built-in function of the Moveshelf API to retrieve the projects the current user has access to. Add the following line of code to get a list of all the projects that are accesible by the user:
    ## Get available projects
    projects = api.getUserProjects()


     

    Examples provided by Moveshelf
    To make your life easier, we have created a list of example use cases for the Moveshelf API. Each example has a dedicated section and is explained in detail later on this page.

    Refer to the following sections for example use cases for importing data:
    Refer to the following sections for example use cases for querying data:
    Refer to the following sections for example use cases for deleting data:
    Refer to the following sections for complete example scripts: