Skip to content

Backend API Endpoints

adamr5000 edited this page Mar 9, 2016 · 3 revisions

Get a information about a user

Endpoint: /generalUser/:userId

Method: GET

Example Response:

  • if error then status 401
{
  "Error": false,
  "Message": "Success",
  "User": [
    {
      "EmailAddress": "hello@apache.org",
      "FirstName": "John",
      "LastName": "Doe",
      "UserType": "Student"
    }
  ]
}

Get a userID for an email and password (login)

Endpoint: /login

Method: POST

Body Fields:

  • emailaddress
  • password

Example Body:

{
    "emailaddress": "hello@apache.org",
    "password": "hello1"
}

Example Response:

  • if error then status 401
{
  "Error": false,
  "Message": "Success",
  "UserID": [
    {
      "UserID": 1
    }
  ]
}

Change a user's password

Endpoint: /update/password

Method: PUT

Body Fields:

  • password
  • userid
  • oldpassword

Example Body:

{
    "userid": 1,
    "password": "wow",
    "oldpassword": "hello1"
}

Response:

  • status 401 if it is an invalid password
  • status 200 if it was successfully changed

Change a user's email

Endpoint: /update/email

Method: PUT

Body Fields:

  • email: the new email
  • userid
  • password

Example Body:

{
    "userid": 1,
    "password": "wow",
    "email": "jonh@gmail.com"
}

Example Response:

  • if error then status 401
{
  "Error": false,
  "Message": "Success",
  "EmailAddress": "jonh@gmail.com"
}

Change a user's name

Endpoint: /update/name

Method: PUT

Body Fields:

  • firstname
  • lastname
  • userid

Example Body:

{
    "userid": 1,
    "firstname": "Holly",
    "lastname": "George"
}

Example Response:

{
  "Error": false,
  "Message": "Success",
  "Name": {
    "fieldCount": 0,
    "affectedRows": 1,
    "insertId": 0,
    "serverStatus": 2,
    "warningCount": 0,
    "message": "(Rows matched: 1  Changed: 1  Warnings: 0",
    "protocol41": true,
    "changedRows": 1
  }
}

Create a semester

Endpoint: /CreateSemester

Method: POST

Body Fields:

  • semesterName
  • startDate
  • endDate

Example Body:

add an example here

Example Response:

{
  "SemesterID": 1
}

Clone this wiki locally