POST
/auth/signup
POST
/auth/login
POST
/users/create/support
POST
/users/create/client
PATCH
/users/{id_user}
POST
/tickets/create
GET
/tickets/{id}
GET
/tickets
PATCH
/tickets/{id}
POST
/tickets/{id}/close
POST
/tickets/{id}/archive
POST
/messages/ticket/{id_ticket}
GET
messages/ticket/{id_ticket}
GET
messages/{id}
PATCH
messages/{id}
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"
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 |
Method: POST
Endpoint: /auth/login
Request | Response |
---|---|
email : User email | token : Access token |
password : User password | user : User struct |
Fields | Description |
---|---|
id | Unique id |
firstname | First name |
lastname | Last name |
type | (Support / Client) |
Method: POST
Endpoint: /users/create/support
Only for support
Request | Response |
---|---|
email : User email | user : User struct |
password : User password |
Method: POST
Endpoint: /users/create/client
Only for support
Request | Response |
---|---|
email : User email | user : User struct |
password : User password |
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 |
Fields | Description |
---|---|
id | Unique id |
title | Title |
author | User struct |
status | (Open / Pending reply / Closed) |
(optional) messages | Array of Message struct |
Method: POST
Endpoint: /tickets/create
Request | Response |
---|---|
title : Ticket name | ticket : Ticket struct |
message : Ticket Description |
Method: GET
Endpoint: /tickets/{id}
Request | Response |
---|---|
ticket : Ticket struct |
Method: GET
Endpoint: /tickets
URI Parameters:
(optional) user : Id of the author
Request | Response |
---|---|
tickets : Array of Ticket struct |
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 |
Method: POST
Endpoint: /tickets/{id}/close
A client can only close a ticket created by himself
Request | Response |
---|---|
ticket : Ticket struct |
Method: POST
Endpoint: /tickets/{id}/archive
A client can only archive a ticket created by himself
Request | Response |
---|---|
ticket : Ticket struct |
Fields | Description |
---|---|
id | Unique id |
text | Content |
author | User struct |
ticket | Ticket struct |
Method: POST
Endpoint: /messages/ticket/{id_ticket}
Request | Response |
---|---|
text : Content | message : Message struct |
Method: PATCH
Endpoint: /messages/{id}
A client can only modify a message created by himself
Request | Response |
---|---|
text : Content | message : Message struct |
Method: GET
Endpoint: /messages/ticket/{id_ticket}
Request | Response |
---|---|
messages : Array Of Message struct |
Method: GET
Endpoint: /messages/{id}
Request | Response |
---|---|
message : Message struct |