Git Product home page Git Product logo

activity_scheduler-rest-api's Introduction

Testing the API Endpoints

Registering a user

  • Send a POST request to the endpoint http://localhost:8080/api/v1/user/register with the following payload:
{
    "name": "Vincent",
    "email": "[email protected]",
    "password": "obi"
}
  • You should get a response similar to this:
{
    "status": "success",
    "message": "User created successfully",
    "id": 6,
    "name": "Vincent",
    "email": "[email protected]",
    "password": "obi",
    "tasks": null
}
  • If you try to register a user with an email that already exists, you should get a response similar to this:
{
    "status": "error",
    "message": "User with that email already exists"
}

Logging in a user

  • Send a GET request to the endpoint http://localhost:8080/api/v1/user/login with the following payload:
{
    "email" : "[email protected]",
    "password" : "1234"
}
  • You should get a response similar to this:
{
    "status": "success",
    "message": "User logged in successfully",
    "id": 1,
    "name": "Fortunate",
    "email": "[email protected]",
    "password": "1234",
    "tasks": [
        {
            "id": 5,
            "title": "Bug Fixed",
            "description": "Internal server error fixed",
            "status": "DONE",
            "createdAt": "2022-09-04T02:01:39.775365",
            "updatedAt": "2022-09-04T03:39:49.336647",
            "completedAt": "2022-09-04T03:39:49.334947"
        },
        {
            "id": 1,
            "title": "REST API",
            "description": "Advanced Restful api",
            "status": "PENDING",
            "createdAt": "2022-09-03T22:34:38.804659",
            "updatedAt": "2022-09-04T03:44:48.679015",
            "completedAt": null
        }
    ]
}
  • If you try to login a user with an email that does not exist, you should get a response similar to this:
{
    "status": "error",
    "message": "User with that email does not exist"
}
  • If you try to login a user with an incorrect password, you should get a response similar to this:
{
    "status": "error",
    "message": "Incorrect password"
}

Creating a task

  • Send a POST request to the endpoint http://localhost:8080/api/v1/user/createTask/6 with the following payload:
{
  "title" : "Tax Created",
  "description" : "Bug fixed! Task mapped to a specific user"
}
  • You should get a response similar to this:
{
    "status": "success",
    "message": "Task created successfully",
    "id": 6,
    "title": "Tax Created",
    "description": "Bug fixed! Task mapped to a specific user",
    "status": "PENDING",
    "createdAt": "2022-09-04T03:44:48.679015",
    "updatedAt": "2022-09-04T03:44:48.679015",
    "completedAt": null
}

Getting all tasks

  • Send a GET request to the endpoint http://localhost:8080/api/v1/user/viewTasks with the following payload`
  • You should get a response similar to this:
[
    {
        "id": 5,
        "title": "Bug Fixed",
        "description": "Internal server error fixed",
        "status": "DONE",
        "createdAt": "2022-09-04T02:01:39.775365",
        "updatedAt": "2022-09-04T03:39:49.336647",
        "completedAt": "2022-09-04T03:39:49.334947"
    },
    {
        "id": 2,
        "title": "PostgreSQL",
        "description": "Checkout PGAdmin latest version",
        "status": "IN_PROGRESS",
        "createdAt": "2022-09-03T22:36:26.580349",
        "updatedAt": "2022-09-04T03:41:40.360972",
        "completedAt": null
    },
    {
        "id": 1,
        "title": "REST API",
        "description": "Advanced Restful api",
        "status": "PENDING",
        "createdAt": "2022-09-03T22:34:38.804659",
        "updatedAt": "2022-09-04T03:44:48.679015",
        "completedAt": null
    },
    {
        "id": 6,
        "title": "Tax Created",
        "description": "Bug fixed! Task mapped to a specific user",
        "status": "PENDING",
        "createdAt": "2022-09-09T02:41:51.130583",
        "updatedAt": "2022-09-09T02:41:51.13065",
        "completedAt": null
    }
]

Getting a task by id

  • Send a GET request to the endpoint http://localhost:8080/api/v1/user/getTask/1
  • You should get a response similar to this:
{
    "id": 1,
    "title": "REST API",
    "description": "Advanced Restful api",
    "status": "IN_PROGRESS",
    "createdAt": "2022-09-03T22:34:38.804659",
    "updatedAt": "2022-09-04T03:44:48.679015",
    "completedAt": null
}

Updating a task

  • Send a PUT request to the endpoint http://localhost:8080/api/v1/user/updateTask/1 with the following payload:
 {
  "id": 1,
  "title": "REST API",
  "description": "Advanced Restful Api in progress"
}
  • You should get a response similar to this:
{
    "status": "success",
    "message": "Task updated successfully",
    "id": 1,
    "title": "REST API",
    "description": "Advanced Restful Api in progress",
    "status": "PENDING",
    "createdAt": "2022-09-03T22:34:38.804659",
    "updatedAt": "2022-09-04T03:44:48.679015",
    "completedAt": null
}

Moving a task forward to the done state

  • Send a GET request to the endpoint http://localhost:8080/api/v1/user/moveForward/2
  • You should get a response similar to this:
{
    "status": "success",
    "message": "Task status moved forward to DONE",
    "id": 2,
    "title": "PostgreSQL",
    "description": "Checkout PGAdmin latest version",
    "status": "DONE",
    "createdAt": "2022-09-03T22:36:26.580349",
    "updatedAt": "2022-09-04T03:41:40.360972",
    "completedAt": "2022-09-04T03:41:40.359272"
}

Moving a task backward to the pending state

  • Send a GET request to the endpoint http://localhost:8080/api/v1/user/moveBackward/1
  • You should get a response similar to this:
{
    "status": "success",
    "message": "Task status moved backward to PENDING",
    "id": 1,
    "title": "REST API",
    "description": "Advanced Restful Api in progress",
    "status": "PENDING",
    "createdAt": "2022-09-03T22:34:38.804659",
    "updatedAt": "2022-09-04T03:44:48.679015",
    "completedAt": null
}

Deleting a task

  • Send a DELETE request to the endpoint http://localhost:8080/api/v1/user/deleteTask/1
  • You should get a response similar to this:
{
    "status": "success",
    "message": "Task deleted successfully"
}

activity_scheduler-rest-api's People

Contributors

nfotech avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.