Giter Club home page Giter Club logo

ticketingapi's Introduction

TicketingApi

Routes

Authentication

POST /auth/signup
POST /auth/login

User management

POST /users/create/support
POST /users/create/client
PATCH /users/{id_user}

Tickets

POST /tickets/create
GET /tickets/{id}
GET /tickets
PATCH /tickets/{id}
POST /tickets/{id}/close
POST /tickets/{id}/archive

Messages

POST /messages/ticket/{id_ticket}
GET messages/ticket/{id_ticket}
GET messages/{id}
PATCH messages/{id}

Use of API

To use any routes of the API, you need to add the version prefix (current v1) before the endpoint.

All request (except for /auth routes) must be made with the access token in the header as follow :
Authorization: Bearer *Your Access Token*

Default support user credentials:
Email: [email protected]
Password: admin

Example of curl command on localhost:
curl -X POST -H 'Authorization: Bearer *your_access_token*' -d '{"title": "Test", "message": "This is a test"}' "localhost:3000/v1/tickets/create"

Authentication

Sign up

Method: POST
Endpoint: /auth/signup

Request Response
firstname : User first name token : Access token
lastname : User last name user : User struct
email : User email
password : User password

Log in

Method: POST
Endpoint: /auth/login

Request Response
email : User email token : Access token
password : User password user : User struct

User management

User struct

Fields Description
id Unique id
firstname First name
lastname Last name
type (Support / Client)
email Email

Create a support user

Method: POST
Endpoint: /users/create/support

Only for support

Request Response
email : User email user : User struct
password : User password

Create a client user

Method: POST
Endpoint: /users/create/client

Only for support

Request Response
email : User email user : User struct
password : User password

Edit a user

Method: PATCH
Endpoint: /users/{id_user}

A client can only modify itself

Request Response
(optional) firstname : User first name user : User struct
(optional) lastname : User last name
(optional) email : User email
(optional) type : User type, only for support
(optional) password : User password

Tickets

Ticket struct

Fields Description
id Unique id
title Title
author User struct
status (Open / Pending reply / Closed)
(optional) messages Array of Message struct

Create a ticket

Method: POST
Endpoint: /tickets/create

Request Response
title : Ticket name ticket : Ticket struct
message : Ticket Description

Get a ticket

Method: GET
Endpoint: /tickets/{id}

Request Response
ticket : Ticket struct

Get a list of tickets

Method: GET
Endpoint: /tickets

URI Parameters:
(optional) user : Id of the author

Request Response
tickets : Array of Ticket struct

Edit a ticket

Method: PATCH
Endpoint: /tickets/{id}/edit

A client can only modify a ticket created by himself

Request Response
title : Title ticket : Ticket struct
status : Status, only for support

Close a ticket

Method: POST
Endpoint: /tickets/{id}/close

A client can only close a ticket created by himself

Request Response
ticket : Ticket struct

Archive a ticket

Method: POST
Endpoint: /tickets/{id}/archive

A client can only archive a ticket created by himself

Request Response
ticket : Ticket struct

Messages

Message Struct

Fields Description
id Unique id
text Content
author User struct
ticket Ticket struct

Add message to ticket

Method: POST
Endpoint: /messages/ticket/{id_ticket}

Request Response
text : Content message : Message struct

Edit a message

Method: PATCH
Endpoint: /messages/{id}

A client can only modify a message created by himself

Request Response
text : Content message : Message struct

Get a ticket's message

Method: GET
Endpoint: /messages/ticket/{id_ticket}

Request Response
messages : Array Of Message struct

Get a message

Method: GET
Endpoint: /messages/{id}

Request Response
message : Message struct

ticketingapi's People

Contributors

rotta-f 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.