Skip to content

Instantly share code, notes, and snippets.

@greatertomi
Created August 1, 2023 20:33
Show Gist options
  • Save greatertomi/f4c570abf333ea6031581db8c701bdd4 to your computer and use it in GitHub Desktop.
Save greatertomi/f4c570abf333ea6031581db8c701bdd4 to your computer and use it in GitHub Desktop.

Integration Guide

Authentication

When you send the email and password that tried logging in on your system to the login endpoint, you will receive a response with a token. This token is used to authenticate all other requests to the API. You should store this token in your application and send it as a header with every request.

const loginData = {
  email: 'test@example.com',
  password: 'abc123',
}

const authResponse = {
  message: 'Login successful',
  token: 'jwt token',
  data: {
    userId: '123',
    matricNumber: '123456',
    firstName: 'John',
    lastName: 'Doe',
    email: 'test@example.com',
    admissionStatus: 'admitted',
  }
}

Endpoints we need

This is an initial list of endpoints we need, and this is subject to discussion.

Subject and test creation webhook

When subject and test is created on the LMS, we need to be notified so that we can add the link to that course on our end. We will expose a POST route that you can send created subjects and tests to.

Sending something like this could help.

const newCourse = {
  name: 'JavaScript Applications',
  courseCode: 'CSC234',
  link: 'https://api.futurex.com/courses/javascript-applications',
  createdAt: '2020-08-17T12:00:00+00:00',
  createdBy: 'Mr name',
}

const newTest = {
  name: 'JavaScript Applications Test',
  courseCode: 'CSC234',
  testNumber: 1,
  link: 'https://api.futurex.com/courses/javascript-applications/test',
  createdAt: '2020-08-17T12:00:00+00:00',
  createdBy: 'Mr name',
}

We will then associate the course using the course code and add it to our database and return a success response.

We could discuss further about this or maybe comment under this gist.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment