Let's Build an API together - Part 2

14.12.2017 by Jens in API Series | APIs | Newsletter

What we got so far:

We will have a single client, which is a single-page application running in a browser. We use HTTP and JSON, and the client must be able to delete and add single tasks. Lane changing is done by setting a property on a task.

Following our assumptions, we must have endpoints for:

  • creating a task
  • deleting a task
  • changing a task aka moving lanes

The next question is, how does the client retrieve all tasks for showing on the board? Which quickly becomes more complex when you start thinking about, like:

  • should the client request all tasks at once? Will it have thousands of tasks?
  • must it be able to search for tasks?
  • do we need other filtering options in the API? Like by category?
  • are there any feature requests we must implement in the mid-term?

As it is the first version, we assume that all tasks are on the same board, so we don’t need any info in the API for that. We also start plain simple and return all tasks and leave it to the user to delete them. Works in our MVP now but we might have to change this sometime soon as it will be too slow with hundreds of tasks.

So, for now, we will have 4 endpoints:

  • creating a task
  • deleting a task
  • changing a task aka moving lanes
  • list all tasks

It looks great for a REST API. But does it really fit? What does REST in its strict way have for consequences?

Want content like this in your inbox each workday? No BS, spam or tricks... just useful content:

I understand and agree to the privacy policy