Skip to content

API Spec

Mars Tan edited this page Apr 12, 2019 · 7 revisions

JSON Objects returned by API

User

{
  "user": {
    "id": "",
    "name": "Tommy Trojan",
    "token": "",
    "username": "trojan.echo",
    "email": "[email protected]",
    "avatar": null
  }
}

Team

{
  "id": "",
  "name": "Team Echo",
  "description": "",
  "color": "green",
  "members": [{
    "name": "Tommy Trojan",
    "username": "trojan.echo",
    "email": "[email protected]",
    "avatar": null
  }, {
    "name": "Mars Tan",
    "username": "mars.tanjx",
    "email": "[email protected]",
    "avatar": null
  }]
}

Meeting

{
  "id": "",
  "title": "",
  "time": "1553479225106",
  "location": "TTH 110",
  "invitees": [{
    "name": "Tommy Trojan",
    "username": "trojan.echo",
    "email": "[email protected]",
    "avatar": null
    }, 
    {
      "name": "Mars Tan",
      "username": "mars.tanjx",
      "email": "[email protected]",
      "avatar": null
    }],
    "agendas": [],
    "team": {
      "id": "",
      "name": "Team Echo",
      "color": "green",
      "description": "",
      "members": [{
        "name": "Tommy Trojan",
        "username": "trojan.echo",
        "email": "[email protected]",
        "avatar": null
      }, 
      {
        "name": "Mars Tan",
        "username": "mars.tanjx",
        "email": "[email protected]",
        "avatar": null
      }]
    },
    "start": "1553479225106",
    "end": "1553480225106"
  }

Agenda (nested in meeting)

{
  "id": "",
  "title": "",
  "description": "",
  "notes": "",
  "tasks": [{
    "id": "",
    "name": "",
    "description": "",
    "due": "1553479225106",
    "status": "1"
  }]
}

Task

{
  "id": 1,
  "name": "Finish A11",
  "description": "need to finish",
  "due": 1553479225106,
  "status": 1,
  "assignees":[{
    "name": "Tommy Trojan",
    "username": "trojan.echo",
    "avatar": "https://randomuser.me/api/portraits/thumb/women/65.jpg"
    }, {
      "name": "Mars Tan",
      "username": "mars.tanjx",
      "avatar": "https://randomuser.me/api/portraits/thumb/men/62.jpg"
    }],
    "team":{
      "id": 1,
      "color":"blue",
      "name": "Team Echo",
      "description": "This team isn't even real.",
      "members": [{
        "name": "Tommy Trojan",
        "username": "trojan.echo",
        "avatar": "https://randomuser.me/api/portraits/thumb/women/65.jpg"
      }, 
      {
        "name": "Mars Tan",
        "username": "mars.tanjx",
        "avatar": "https://randomuser.me/api/portraits/thumb/men/62.jpg"
      }]
    }
}
// statuses: 1 = upcoming, 2 = in progress, 3 = complete

Errors and Status Codes

If a request fails any validations, expect a 422 and errors in the following format:

{
  "errors":{
    "body": [
      "can't be empty"
    ]
  }
}
Other status codes

401 for Unauthorized requests, when a request requires authentication but it isn't provided

403 for Forbidden requests, when a request may be valid but the user doesn't have permissions to perform the action

404 for Not found requests, when a resource can't be found to fulfill the request