Skip to content

Latest commit

 

History

History
188 lines (138 loc) · 1.86 KB

README.md

File metadata and controls

188 lines (138 loc) · 1.86 KB

Server

The server application is the API for the client to access ticket and user data.

When you run yarn start, the API is available at http://localhost:4200/api.

Endpoints

Fetch tickets

Request:

GET /api/tickets

Sample Response:

[
  {
    "id": 1,
    "description": "Install a monitor arm",
    "assigneeId": 1,
    "completed": false
  },
  {
    "id": 2,
    "description": "Move the desk to the new location",
    "assigneeId": 1,
    "completed": false
  }
]

Fetch single ticket

Request:

GET /api/tickets/:id

Sample Response:

{
  "id": 1,
  "description": "Install a monitor arm",
  "assigneeId": 1,
  "completed": false
}

Fetch users

Request:

GET /api/users

Sample Response:

[
  {
    "id": 1,
    "name": "Alice"
  },
  {
    "id": 2,
    "name": "Bob"
  },
  {
    "id": 3,
    "name": "Chris"
  },
  {
    "id": 4,
    "name": "Daisy"
  },
  {
    "id": 5,
    "name": "Ed"
  }
]

Fetch single user

Request:

GET /api/users/:id

Sample Response:

{
  "id": 1,
  "name": "Alice"
}

Create ticket

Request:

POST /api/tickets

Request Body:

{
  "description": "Install a monitor arm"
}

Sample Response:

{
  "id": 1,
  "description": "Install a monitor arm",
  "assigneeId": null,
  "completed": false
}

Assign user to ticket

Request:

PUT /api/tickets/:ticketId/assign/:userId

Response:

204 No Content

Unassign user from ticket

Request:

PUT /api/tickets/:ticketId/unassign

Response:

204 No Content

Mark ticket as complete

Request:

PUT /api/tickets/:id/complete

Response:

204 No Content

Mark ticket as incomplete

Request:

DELETE /api/tickets/:id/complete

Response:

204 No Content