Tahoe Registration API

API Endpoints available for registering users on Tahoe from a third-party system. 

Use these to collect initial registration information from users through an external system (including information that Tahoe doesn’t need like instance: title, department, company, etc) and then send the relevant information over to Tahoe to start the learner’s registration process there. 

Important note:

Registration is the process of signing up for an account on an Open edX site. It requires at least an email, name, username, password, and acceptance of TOU/Privacy Policy. It does not enroll the user in any courses.

Enrollment is the process of enrolling a registered user in one or more courses.

User Registration / Creation

Endpoint: https://<yoursitename>.tahoe.appsembler.com/tahoe/api/v1/registrations/
Request Method: POST

Required Parameters

Name Type Description
username string The user’s Tahoe username. This is a unique value in the Tahoe system, and cannot be changed once set.
email string The user’s email address. This is also a unique value in the Tahoe system, but can be updated by the user from their profile management page.
name string The user’s full name.

Optional Parameters

Name Type Description
password string Set the user’s password. This is useful if you’re gathering the password at registration time in another system, and want to pass that value along to Tahoe. If you wish to skip the automatic account activation email, you can do so by setting the send_activation_email parameter to False. If you do not specify a password, no activation email is sent. Instead, the user is sent a password-reset email, so they can set their own secure password.
send_activation_email boolean Note: If you do not provide a password, this value is automatically set to False and cannot be overridden. In that case, the user receives a password-reset email, so they can set their own secure password.If you provide a password, this defaults to True, but can be overridden to False. If you set it to False, you are responsible for verifying the accuracy of the email address. You are confirming that you have already done so via another system, in accordance with best practices for account creation.

Return

Response Code Description
HttpResponse: 200 User registration successful. Response body contains the user_id for use in future API calls (e.g. {“user_id”: 9})
HttpResponse: 400 Invalid request. May be missing required parameters, or parameters of the wrong type.
HttpResponse: 409 An account with the given username or email address already exists.

Examples

This example uses the curl command to submit the POST, but you can use your tool or library of choice.

curl -v -X POST \
  https://<yoursitename>.tahoe.appsembler.com/tahoe/api/v1/registrations/ \
  -H 'Authorization: Token <insert token here>' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
"username": "auserton",
"email": "alex.userton@example.com",
"name": "Alex Userton"
}'

Here’s an example using Python to submit the POST.

#!/usr/bin/env python

import os
import pprint
import requests

import faker
import random

FAKE = faker.Faker()

host = 'https://<yoursitename>.tahoe.appsembler.com'
api_url_root = host + '/tahoe/api/v1/'
reg_api_url = api_url_root + 'registrations/'

def generate_user_info():
    return dict(
        name=FAKE.name(),
        username=FAKE.user_name(),
        email=FAKE.email(),
        password=FAKE.password()
    )

def register_user(data):

    print('calling url:{} with data:'.format(reg_api_url))
    pprint.pprint(data)

    my_token = os.environ.get('TAHOE_API_USER_KEY')

    response = requests.post(
        reg_api_url,
        headers={'Authorization': 'Token {}'.format(my_token)},
        data=data)

    return response.json()

def main():
    # reg_data = dict(
    #     name='El Mo',
    #     username='elmo',
    #     email='elmo@example.com',
    #     password='bad-password',
    #     )

    reg_data = generate_user_info()
    print('Registering user:')
    pprint.pprint(reg_data)
    print('making call...')
    response_data = register_user(reg_data)
    print('response data:')
    pprint.pprint(response_data)


if __name__ == '__main__':
    main()

Still need help? Contact Us Contact Us