adityabisoi/json-hub

Extend the /tasks endpoint

Closed this issue · 3 comments

  • The endpoint should be able to return a task at a given index. For an invalid index, return an error message.
    // GET /tasks/2
    // Returns the task at index 2 as specified in taskdata.json.
    {
        "task_name": "eating",
        "completed": false,
        "details": "having nice and healthy food"
    }
  • The endpoint should allow returning a the specified number of tasks as and if specified in the count parameter. If specified, an array must be returned.
    // GET /tasks/2?count=3
    // Starts from the task at index 2 and returns a total of 3 tasks.
    [
      {
        "task_name": "eating",
        "completed": false,
        "details": "having nice and healthy food"
      },
      {
        "task_name": "sleeping",
        "completed": true,
        "details": "have a good sleep"
      },
      {
        "task_name": "writing",
        "completed": true,
        "details": "write a diary entry or blog posts to have thoughts organized"
      }
    ]
    If no task index is specified, start from index 0 by default.
    // GET /tasks?count=2
    // Returns 2 tasks, starting at index 0 by default.
    [
      {
        "task_name": "reading",
        "completed": true,
        "details": "keep up with the world and broaden your horizons"
      },
      {
        "task_name": "drinking",
        "completed": true,
        "details": "drink delicious chai or coffee"
      }
    ]

I would like to work on this issue, will you please assign me.

OK! Assigned, @Samridhi-98 . Go ahead.

OK! Assigned, @Samridhi-98 . Go ahead.

Thank you!