ArtaxIt

Contributors

Endpoint

https://mcval.herokuapp.com/

Content-type should all be JSON

Available Route

HTTP Method Route Request Body Request Param Example Response
POST /sign_up ✔️
{
    "first_name":"test5",
    "last_name":"test5",
    "phone_number":2087418523,
    "company_name":"myCompany",
    "username":"test8",
    "password":"secured",
    "email":"myemail@gmail.com"
}
{
  "status": "good",
  "message": "User is created"
}
POST /log_in ✔️
{
   "username":"test8",
   "password":"secured"
}
{
   "status": "good",
   "username": "test8",
   "token":     "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxNCwidXNlcm5hbWUiOiJ0ZXN0OCIsImNvbXBhbnlfbmFtZSI6Im15Q29tcGFueSIsImlhdCI6MTYxMjM5NzM3MywiZXhwIjoxNjEyNDgzNzczfQ.C0CRR1vQC_v-CY53GllZioRHMo05TC9gh_j4N2FJvZc",
   "user_role":"client"/"admin",
   "company_name": "myCompany",
   "message": "Logged in"
}
GET /log_out

null

{
    "status": "good",
    "message": "Logged out"
}
GET /dashboard

null

{
    "subscription": {
        "status": "good",
        "plan_status": "Active",
        "userID": 14,
        "planName": "careBasic",
        "next_billing_day": "2021-01-31T07:00:00.000Z"
    },
    "trouble_ticket": {
        "status": "good",
        "ticket": [
            {
                "id": 1,
                "issue": "test1",
                "description": "test wrong",
                "datetime": "2021-02-01T08:46:52.000Z",
                "priority": 0,
                "status": 0,
                "customer": 14,
                "published_at": null,
                "created_by": null,
                "updated_by": null,
                "created_at": "2021-02-01T08:46:52.000Z",
                "updated_at": "2021-02-01T08:46:52.000Z",
                "image_link": null
            }
        ]
    }
}
GET /dashboard/subscription/createAgreement/:id

null

{
    "url": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-4073148070L"
}
GET /dashboard/subscription/purchase

null

{
    "status": "good",
    "plan": "careBasic",
    "next_billing_day": "2021-01-31"
}
GET /dashboard/subscription/cancel

null

{
    "status": "good",
    "message": "successfully delete your subscription"
}
POST /ticket/create ✔️
{
    "issue":"error in test5",
    "description":"something is wrong with the index file"
}
{
     "status": "good",
     "message": "Ticket create successfully"
}
GET /ticket/view

null

{
    "status": "good",
        "ticket": [
            {
                "id": 1,
                "issue": "test1",
                "description": "test wrong",
                "datetime": "2021-02-01T08:46:52.000Z",
                "priority": 0,
                "status": 0,
                "customer": 14,
                "published_at": null,
                "created_by": null,
                "updated_by": null,
                "created_at": "2021-02-01T08:46:52.000Z",
                "updated_at": "2021-02-01T08:46:52.000Z",
                "image_link": null
            }
        ]
}
PATCH /user/edit ✔️
{
 "first_name": "first",
 "last_name": "last",
 "phone_number": 22222,
 "company_name": "artaxIt"
}
{
    "status": "good",
    "first_name": "first",
    "last_name": "last",
    "phone_number": 22222,
    "company_name": "artaxIt",
    "message": "Successfully update user info"
}
POST /user/forgotpassword ✔️
{
 "email": "myemail@gmail.com",
 "username": "secured"
}
{
     "status":"good",
     "message":"Check your email"
}
POST /user/resetpassword ✔️ ✔️

Body:

{
 "password": "fgfggdgdfgdgdg"
}

Query: ?au=dsdsfsdfsdjhfskadjfhsdkfhsdfhsdfhksdfhsdlfsdfjkdshfsdhfsk (append this after the request url)

{
    "status": "good",
    "message": "Successfully update your password"
}
POST /ticket/create_pic ✔️

Form data { "issue":"error in test5", "description":"something is wrong with the index file", "Image":file that user attaches }

{
     "status": "good",
     "message": "Ticket create successfully"
}
GET /user/information

null

{
    "status": "good",
    "first_name": "test5",
    "last_name": "test5",
    "phone_number": "2087418523",
    "company_name": "myCompany"
}
GET /admin/retrieve_users ✔️

?reload=1 if you want to refresh to get latest data,if you don't want to refresh, don't add it to the request url ?page=#pagenumber if you want to get a specific page, if not don't add it to the request url, just follow the url given in next and prev attribute

    {
    "status": "good",
    "next": "http://localhost:3000/admin/retrieve_users?page=2",
    "prev": null,
    "totalPage": 2,
    "currentPage": 1,
    "users": [
        {
        "user_id": 50,
        "info": {
            "first_name": "A",
            "last_name": "L",
            "email": "ali@mcval.net",
            "company_name": "Artaxit",
            "phone_number": "a",
            "plan_id": "1",
            "next_billing_day": "2021-03-05T07:00:00.000Z",
            "tickets": [
                {
                    "ticket_id": 37,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 42,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 46,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 60,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                }
            ]
        }
    },
       {
        "user_id": 50,
        "info": {
            "first_name": "A",
            "last_name": "L",
            "email": "ali@mcval.net",
            "company_name": "Artaxit",
            "phone_number": "a",
            "plan_id": "1",
            "next_billing_day": "2021-03-05T07:00:00.000Z",
            "tickets": [
                {
                    "ticket_id": 37,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 42,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 46,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 60,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                }
            ]
        }
    }
    ]
}
POST /admin/close_ticket ✔️
{
   "ticket_id":1
}
{
    "status": "good",
    "message": "The ticket is closed"
}
POST /admin/remove_ticket ✔️
{
   "ticket_id":1
}
{
    "status": "good",
    "message": "The ticket is removed"
}
GET /admin/get_tickets ✔️ ?status=close or ?status=open, if you want to retrieve both open and closed tickets, you don't need to use this query string
{
  
    "status": "good",
    "tickets": [
        {
            "ticket_id": 1,
            "customer": 14,
            "issue": "test1",
            "status": "close"
        },
        {
            "ticket_id": 2,
            "customer": 14,
            "issue": "test1",
            "status": "open"
        },
        {
            "ticket_id": 3,
            "customer": 14,
            "issue": "test1",
            "status": "open"
        }
              ]     
}
GET /admin/getselectedTickets/:ticket_id ✔️ For example: https://mcval.herokuapp.com/admin/getselectedTickets/25
{
    "status": "good",
    "tickets": {
        "user_id": 14,
        "plan_id": "1",
        "next_billing_date": "2021-03-05T07:00:00.000Z",
        "first_name": "Ali",
        "last_name": "Next Client ",
        "phone_number": "123",
        "company_name": "Food served",
        "email": "myemail@gmail.com",
        "ticket_id": 1,
        "issue": "test1",
        "description": "test wrong",
        "priority": 0,
        "image_link": null,
        "status": "close"
    }
}
GET /admin/getuser_info/:user_id ✔️ For example: https://mcval.herokuapp.com/admin/getuser_info/14
{
        "user_id": 50,
        "info": {
            "first_name": "A",
            "last_name": "L",
            "email": "ali@mcval.net",
            "company_name": "Artaxit",
            "phone_number": "a",
            "plan_id": "1",
            "next_billing_day": "2021-03-05T07:00:00.000Z",
            "tickets": [
                {
                    "ticket_id": 37,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 42,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 46,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                },
                {
                    "ticket_id": 60,
                    "description": null,
                    "priority": 0,
                    "status": "open"
                }
            ]
        }
    }
GET /admin/getAll_Users ✔️ ?status=open or status=close
 {
    "status": "good",
    "user": [
        {
            "id": 2,
            "email": "test@test.com",
            "first_name": "test_customer",
            "company_name": "test"
        },
        {
            "id": 3,
            "email": "test@admin.com",
            "first_name": "test_admin",
            "company_name": "ArtaxIT"
        }, 
    ]
}
    
POST /admin/reopen_ticket ✔️
{
   "ticket_id":1
}
{
    "status": "good",
    "message": "The ticket is reopened"
}