This Documentation was available here for the REST API of Chat Viewer. This Documentation has Two Sections,
This API was used to manipulate user details in the chat viewer Application.
This API uses the Google sign-in button to get the work done, the token was the token generated by Google Sign In. This API Gives the JWT token for further use of the API
POST {{host}}/api/v1/users/{
"token": "xxx"
}Find the User Details and JWT token in the response
auth-token {{token}}
{
"userId": 1,
"name": "Sri Lakshmi Kanthan P",
"email": "srilakshmikanthan.p@gmail.com",
"createdAt": "2022-07-23T21:39:46.000Z",
"updatedAt": "2022-07-23T21:40:34.000Z"
}This API was used to get the user details from the Application, None of the user details is public so you must give the JWT token to get the details.
GET {{host}}/api/v1/users/meAuthorization Bearer <Token>{
"userId": 1,
"name": "Sri Lakshmi Kanthan P",
"email": "srilakshmikanthan.p@gmail.com",
"createdAt": "2022-07-23T21:39:46.000Z",
"updatedAt": "2022-07-23T21:40:34.000Z"
}This API was to update the user details currently only updatable field is the Name
PATCH {{host}}/api/v1/users/meAuthorization Bearer <Token>{
"name": "Sri Lakshmi Kanthan P"
}{
"userId": 1,
"name": "Sri Lakshmi Kanthan P",
"email": "srilakshmikanthan.p@gmail.com",
"createdAt": "2022-07-23T21:39:46.000Z",
"updatedAt": "2022-07-23T21:40:34.000Z"
}This will remove all details of the user, so make correct use of it
DELETE {{host}}/api/v1/users/meAuthorization Bearer <Token>{
"message" : "ok"
}This API was used to manipulate the chat details of a user.
This API is used to create a new chat for the user.
POST {{host}}/api/v1/chatsAuthorization Bearer <Token>{
"base64" : "Encoded in base64 with mime type",
"name" : "Name of the chat",
}{
"blobUrl": "http://localhost:8000/api/v1/chats/2/blob",
"name": "Chat 1",
"chatId": 2,
"userId": 1,
"createdAt": "2022-07-23T22:16:42.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
}This API is used to get all chats of the user
GET {{host}}/api/v1/chatsAuthorization Bearer <Token>The Query Parameters have been used for paging the results. It returns results with a link header.
perPage: Number of chats per pagepage: Number of PagesortBy: Sort by field eithercreatedAtorupdatedAtorname
[
{
"blobUrl": "http://localhost:8000/api/v1/chats/2/blob",
"name": "Chat 1",
"chatId": 2,
"userId": 1,
"createdAt": "2022-07-23T22:16:42.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
},
{
"blobUrl": "http://localhost:8000/api/v1/chats/3/blob",
"name": "Chat 2",
"chatId": 3,
"userId": 1,
"createdAt": "2022-07-24T07:16:16.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
}
]This API was used to get the Specific chat if the user
GET {{host}}/api/v1/chats/2Authorization Bearer <Token>{
"blobUrl": "http://localhost:8000/api/v1/chats/2/blob",
"name": "Chat 1",
"chatId": 2,
"userId": 1,
"createdAt": "2022-07-23T22:16:42.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
}This API is used to update the chat of the user, currently, the only updatable field is the Name
PATCH {{host}}/api/v1/chats/2Authorization Bearer <Token>{
"name": "Chat 1"
}{
"blobUrl": "http://localhost:8000/api/v1/chats/2/blob",
"name": "Chat 1",
"chatId": 2,
"userId": 1,
"createdAt": "2022-07-23T22:16:42.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
}This API is used to delete the chat of the user
DELETE {{host}}/api/v1/chats/3Authorization Bearer <Token>{
"message" : "ok"
}This API is used to get the BLOB of the Chat
GET {{host}}/api/v1/chats/2/blobAuthorization Bearer <Token>Raw data, identify with the ContentType
This API is used to generate a JWT token for the chat, so it can be shared easily
GET {{host}}/api/v1/chats/2/tokenAuthorization Bearer <Token>expiresIn: The valid time for the token (default: 30d)
The header will contain the token
chat-token <Token>You can generate a token for a specific chat with that token, and use this API to get the chat details
GET {{host}}/api/v1/chats/shared/<token>{
"blobUrl": "https://url-to-the-blob",
"name": "Chat 1",
"chatId": 2,
"userId": 1,
"createdAt": "2022-07-23T22:16:42.000Z",
"updatedAt": "2022-07-23T22:16:42.000Z"
}You can generate a token for a specific chat with that token, and use this API to get the blob of chat
GET {{host}}/api/v1/chats/shared/<token>/blobRaw data, identify with the ContentType