Set up the Data Analytics API Server#

This chapter describes how to set up and test the edX Data Analytics API server:

  1. Get the Repository

  2. Install Server Requirements

  3. Run the Server

  4. Load Sample Data

  5. Test the Data Analytics API

Also see edX Data Analytics API Authentication.

Get the Repository#

You must get the Data Analytics API repository from GitHub.

From the terminal, enter:

git clone https://github.com/openedx/edx-analytics-data-api

You may choose to get the repository in a virtual environment.

Install Server Requirements#

From the terminal at the top level of the server repository, enter:

$ make develop

Server requirements are then installed.

Run the Server#

From the terminal at the top level of the server repository, enter:

$ ./manage.py runserver

The server starts.

Load Sample Data#

From the terminal at the top level of the server repository, enter:

$ make loaddata

Test the Data Analytics API#

After you load sample data and run the server, you can test the API.

  1. In a browser, go to: http://<server-name>:<port>/docs/#!/api/

  2. Enter a valid key and click Explore.

    See edX Data Analytics API Authentication for information on keys.

    You see an interactive list of API endpoints, which you can use to get responses with the sample data. Expand the api section to see the available endpoints.

    The API test web page
  1. Expand the section for an endpoint:

    The API test web page with an expanded endpoint
  2. Enter parameters as needed and click Try it out. The response opens:

    The API test web page with a response

To get the sample enrollment data, use edX/DemoX/Demo_Course as the course_id.