Skip to content

Pomoday Backend API Specification

Huy edited this page Feb 19, 2020 · 1 revision

Pomoday Backend (BE) allows Pomoday Frontend (FE) to synchronize task list through a REST API which supports authentication. This documentation describes the API endpoints.

Using the API

BE is designed with simplicity in mind, which doesn't account much for security or robustness [at this moment]; however, this design allows you to quickly rollout your own sync server to use with Pomoday with only a few API endpoints.

Workflows

Typically as BE, your server needs to handle 2 type of requests:

  • Get a list of tasks: for the initial sync and periodical sync
  • Update a list of tasks: to update the Backend when there is change in Frontend

To secure each request, we support basic authentication as authentication protocol. While this is optional, we suggest that you also support it so that your data has at least some protection. Popular web frameworks like Rails support this authentication out-of-box.

Get a list of tasks (Required)

  • Endpoint:
GET /list
  • Paramaters: None (currently we don't support pagination yet)

  • Response: A JSON object contains an array of ALL task resources.

  • Sample response:

{
   "tasks":[
      {
         "id":1,
         "uuid":"ee493663-78a1-41f0-a5b2-f5456df77d54",
         "archived":true,
         "tag":"@pomoday",
         "title":"working on sync",
         "status":0,
         "lastaction":0,
         "logs":[
            {
               "start":1546369440,
               "end":1546369800
            },
            {
               "start":1546369860,
               "end":1546370400
            }
         ]
      },
      {
         "id":2,
         "uuid":"1b5c7a88-f7d7-4e58-95d5-acd3ee6bb3f5",
         "archived":false,
         "tag":"@pomoday",
         "title":"fix test error",
         "status":1,
         "lastaction":3,
         "logs":[
            {
               "start":1546456260,
               "end":1546456800
            }
         ]
      }
   ]
}

Update a list of tasks

  • Endpoint:
PUT /list
  • Parameters
Field Type Description
tasks Array[Task] A list of ALL tasks
  • Response: A JSON object contains updated list of ALL task resources.

  • Sample response:

{
   "tasks":[
      {
         "id":1,
         "uuid":"ee493663-78a1-41f0-a5b2-f5456df77d54",
         "archived":true,
         "tag":"@pomoday",
         "title":"working on sync",
         "status":0,
         "lastaction":0,
         "logs":[
            {
               "start":1546369440,
               "end":1546369800
            },
            {
               "start":1546369860,
               "end":1546370400
            }
         ]
      },
      {
         "id":2,
         "uuid":"1b5c7a88-f7d7-4e58-95d5-acd3ee6bb3f5",
         "archived":false,
         "tag":"@pomoday",
         "title":"fix test error",
         "status":1,
         "lastaction":3,
         "logs":[
            {
               "start":1546456260,
               "end":1546456800
            }
         ]
      }
   ]
}

What's next?

If you're disappointed that Pomoday BE is not designed with security or robustness in mind, don't be! These parts are exactly the one that we're focusing on next to deliver more pleasant experience to you.

Currently we're implementing more complex features that allows us to sync more efficiently, consistently and securely. In the next main release of BE, we expect to release:

  • More secure version of authentication using OAuth
  • CRDT-based or events-based sync functionality

Stay tune!

Appendix

Status

Value Meaning
0 deleted
1 finished
2 in-progress
3 pending
4 flagged

Task resource

Field Type Description
id Integer The ID that is displayed on the user side
uuid String Globally unique ID to identify task in BE
archived Boolean Indicate whether a task is archived or not
tag String Indicate the tag that this task belongs to
title String Description of task
status Integer Indicate the status of a task. Details value is here
lastaction Timestamp Indicate the moment that the task is last updated
logs Array[Log] A list of log objects

Log resource

  • This object describe a period that the task is in-progress.
Field Type Description
start Timestamp start of a period
end Timestamp end of a period