Description
The chat API is a very simple chat-api where users can chat with each other. For this to work you need basic information.
The chat API consists of a couple of API urls that you can use.
At this stage the API is open to ALL. So if 4 students use this API all students will see the information. In a next version we need to create your own registration-key.
There are certain steps, here are the steps, click on a sub-page for more information.
Register Allows chat users to register them selfs with the system.
Login Login to the system if you are not yet logged in
Get chat users Get all the registered chat users
Get all messages Get all your messages
Get all message to/ from user Get all the messages to and from a specific chat user
Forgot password Get an email from the system to reset your chat password

Important API information (read when starting to build)

Bearertoken information
In tradition server-client solutions there is a SESSION that you can use for storing information like login information.
In an API-solution this SESSION does not exist due to the way API traffic works with servers (long story, Google it for more information ;-))
In order to check if a user has a valid login we use a bearertoken after a succesful registration or login the API will return a bearertoken (long string) which identifies the user.
For every action with the logged-in user you need to send the bearertoken either in GET (in the fetch URL) or in POST data (formdata) with you API calls.
Building hint!
When starting to build this API, make sure you have a solid plan on what pages you want to build, maybe you want to build a SPA (single page application) where different screens are in one HTML-page, or you might want to build multiple pages. In all forms, please store the users bearertoken in the localStorage or a cookie.
POST and GET API Fetch's
When sending information to a server on internet you can use either a GET or a POST request.
GET request
The traditional and easiest way is a GET request. In a GET request all the information send to the server is shown in the URL of the FETC. If you want to send a bearertoken to get all the users the API URL will look like something like this:
https://mbo-sd.nl/api/chat/get-all-chatusers/85fa1ef3262df01b1ac98005581ce4f1a68f0b93b75529929525886193a27c99671faf373b09366239f18aa473db212eaf17f92ebe1467fd6777cfba33f27c52
We can split this URL up in to 2 parts, the URL and the bearertoken
URL: https://mbo-sd.nl/api/chat/get-all-chatusers/
bearertoken: 85fa1ef3262df01b1ac98005581ce4f1a68f0b93b75529929525886193a27c99671faf373b09366239f18aa473db212eaf17f92ebe1467fd6777cfba33f27c52

As stated above the bearertoken is provided by the API after successfull registration/ login of the user.
The bearertoken might have an lifetime of a day or 30 days and may be reseted by the system.
Using mandatory properties in the readme
When a property is mandatory in the readme this is shown with < - > signs.
The readme will show you:
https://mbo-sd.nl/api/chat/get-all-chatusers/<bearertoken>
POST request
With the POST request you do not send extra data in the URL (traditionally, some API's might let you do it though)
With a POST request you will send the information that you need to send to the FETCH URL inside the headers of the request. Doing this will not let you see the information, but it will be send.
How to do this, check Google ;-) (Or later on MBO-SD :-))
Back to readme index pages
Known links
chat-forgot-password
chat-get-all-messages
chat-get-user-messages
chat-get-users
chat-login
chat-register


Or go back to the readme index:
Return home...