backend/research/API Documentation.md

7.5 KiB

API Documentation


Values required in bold.

Accounts | account

field data type metadata
id unsigned integer primary key, auto-increments, generated by database
username varchar required
email varchar required
password varchar required
timezone varchar
earliest_time varchar
latest_time varchar
created_at datetime generated by database

Register an account

POST /api/account/register

Request

A json object for the user to register with username, email, password, timezone, earliest_time and latest_time.

{
  "username": "jean",
  "email": "jean@example.com",
  "password": "really-strong-password",
  "timezone": "Europe/Brussels",
  "earliest_time":"09:30 AM",
  "latest_time":"10:00 PM"
}
Response

A json object for the registered user with id, username, email, timezone, earliest_time and latest_time.

{
  "status": 201,
  "data": {
    "id": 1,
    "username": "jean",
    "email": "jean@example.com",
    "timezone": "Europe/Brussels",
    "earliest_time":"09:30 AM",
    "latest_time":"10:00 PM"l
  }
}

Log in an account

POST /api/account/login

Request

A json object for the user to login with either email or username, and password .

{
  "username": "jean",
  "password": "super-strong-password"
}
Response

A json object for the registered user with id, username, email, timezone, earliest_time and latest_time.

{
  "status": 201,
  "data": {
    "id": 1,
    "username": "jean",
    "email": "jean@example.com",
    "timezone": "Europe/Brussels",
    "earliest_time":"09:30 AM",
    "latest_time":"10:00 PM"l
  }
}

Update an account

PUT /api/account/:id/profile

Request

A json object for the user to register with id and any of username, email, password, timezone, earliest_time, latest_time.

{
  "id": 15,
  "earliest_time": "08:30 AM",
  "latest_time": "08:00 PM"
}
Response

A json object for the registered user with id, username, email, timezone, earliest_time and latest_time.

{
  "status": 200,
  "data": {
    "id": 1,
    "username": "jean",
    "email": "jean@example.com",
    "timezone": "Europe/Brussels",
    "earliest_time": "09:30 AM",
    "latest_time": "10:00 PM"
  }
}

Delete an account

DELETE /api/account/:id

Request

A json object for the user to delete with id.

{
  "id": 15
}
Response

A json object for the deleted user with username and email.

{
  "status": 200,
  "data": {
    "id": 15,
    "username": "jean",
    "email": "jean@example.com"
  }
}

Meetings | meeting

field data type metadata
id varchar primary key, first 30 chars of title with words separated by - + 5 random int
title varchar required
description varchar
start_time datetime
timezone varchar
duration int required
status boolean required: 0 (proposed) or 1 (confirmed)
password varchar
created_at datetime generated by database

Add a meeting

POST /api/meeting/add

Request

A json object for the meeting to add with id, title, description, start_time, duration and password.

{
  "id": "worldwide-strategy-meeting-for-11059",
  "title": "Worldwide strategy meeting for growth",
  "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
  "duration": 90,
  "password": "generic-password"
}
Response

A json object for the added meeting with id, title, description, start_time, duration, status and password.

{
  "status": 201,
  "data": {
    "id": "worldwide-strategy-meeting-for-11059",
    "title": "Worldwide strategy meeting for growth",
    "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
    "duration": 90,
    "status": 0
  }
}

Get a list of meetings for an account

GET /api/meeting/account/:account_id

Request

A json object with an account_id.

{
  "id": 5
}
Response

A json object for the specified account with an array of meeting.

{
  "status": 200,
  "data": [
            {
              "id": "worldwide-strategy-meeting-for-11059",
              "title": "Worldwide strategy meeting for growth",
              "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
              "start_time": 2022-02-16 20:00:00,
              "timezone": "Europe/Brussels",
              "duration": 60,
              "status": 1
            },
            {
              "id": "follow-up-with-tech-team-21850",
              "title": "Follow up with tech team",
              "duration": 120,
              "status": 0
            }
          ]
}

Update a meeting

PUT /api/meeting/:id

Request

A json object for the meeting to update with id, acount_id and any of title, description, start_time, timezone, duration, status and password.

{
  "id": "worldwide-strategy-meeting-for-11059",
  "account_id": 5,
  "start_time": 2022-02-16 20:00:00,
  "timezone": "Europe/Brussels",
  "status": 1
}
Response

A json object for the updated meeting with id, title, description, start_time, timezone, duration and status.

{
  "status": 200,
  "data": {
    "id": "worldwide-strategy-meeting-for-11059",
    "title": "Worldwide strategy meeting for growth",
    "description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
    "start_time": 2022-02-16 20:00:00,
    "timezone": "Europe/Brussels",
    "duration: 90,
    "status": 1
  }
}

Delete a meeting

DELETE /api/account/:id

Request

A json object for the meeting to delete with id and account_id.

{
  "id": "worldwide-strategy-meeting-for-11059",
  "account_id": 5
}
Response

A json object for the deleted user with username and email.

{
  "status": 200,
  "data": {
    "id": "worldwide-strategy-meeting-for-11059",
    "title": "Worldwide strategy meeting for growth",
  }
}