-
Notifications
You must be signed in to change notification settings - Fork 0
Upload content endpoint (Legacy)
Not to be confused with Upload content endpoint (Non deprecated) this endpoint is no longer supported and is only present for backwards compatibility.
This is the upload content endpoint, this endpoint will upload the content to the server. This endpoint will expect an 'id' argument for the id of the image, a 'type' argument for the type of the content (This MUST be either 'CHILL&CHAT_GIF' for a gif file type or 'CHILL&CHAT_IMG' for an image), a 'content' argument for the content to be uploaded and a 'user' argument for the user who sent the image. Furthermore, this endpoint will return a status of '401' on an invalid API key, '201' on success and '500' on an internal server error. The source code is located in /src/endpoints/uploadContent.ts
.
The content must be encoded in a base-64 format to be able to be uploaded to Chill&chat, please see https://en.wikipedia.org/wiki/Base64
for more information.
post("http://<URL>/api/upload-content?key=<YOUR_API_KEY>", {
id: "<ID>",
user: "<USER>",
type: "<TYPE>",
content: "<CONTENT>",
})
.then((res) => {
console.log(res);
})
.catch((err) => {
console.error(err);
});
As the content argument for this endpoint requires that the image MUST be in a base-64 format, so here's how to encode it in node.js
import fs from "fs";
const encoded = fs.readFileSync("<FILE>", "base-64");
You can check https://nodejs.org/api/fs.html#fsreadfilesyncpath-options
for more information on how to use it.
- Home
- Login endpoint
- Block user endpoint
- Create room endpoint
- Delete user endpoint
- Get all rooms endpoint
- Get GIF endpoint
- Get messages endpoint
- Get public rooms endpoint
- Get user info endpoint
- Get users info endpoint (Deprecated)
- Join room endpoint
- Signup endpoint
- Report room endpoint
- Remove room endpoint
- Update description endpoint
- Follow user endpoint
- Unfollow user endpoint
- Update icon color endpoint
- Upload content endpoint
- Upload content endpoint (Deprecated)
- Verify client endpoint
- Upload token endpoint
- Chill&chat websockets
- Message socket
- Keyboard socket
- Delete message socket
- User content
- Final words&thoughts
- Run API