-
Notifications
You must be signed in to change notification settings - Fork 0
Upload content endpoint
This is the upload content endpoint, this endpoint will as the name suggests, upload a piece of content to the Chill&chat cloud service. This service makes it easy to upload custom chat images and profile images and use them from other places around the frontend app. This endpoint takes a couple of arguments, a 'key' parameter for the API key, an 'id' parameter for the id of the image, a 'user' parameter for the user it's assigned to, a 'type' parameter that is an enum that allows for 'CHILL&CHAT_IMG' and 'CHILL&CHAT_GIF' values for the respective types, and finally, a boolean 'useBinaryUpload' parameter for whether to use the old upload endpoint. Furthermore, this endpoint will return '401' on invalid API key, '500' on server error and '400' for invalid input. The source code is at /src/endpoints/uploadContent.ts
. Anyways, here's an example!
fetch(
"http://<URL>/api/upload-content?key=<YOUR_API_KEY>&id=<ID>&user=<USER>&type=<TYPE>",
{
method: "POST",
headers: {
"Content-Type": "application/octet-stream",
},
body: {
/*<FILE>*/
},
}
)
.then((res) => {
console.log(res);
})
.catch((err) => {
console.error(err);
});
Please note that since we are uploading via binary, we need to set the Content-Type
request header to application/octet-stream
. Please see: https://developer.mozilla.org/en-US/docs/Glossary/Request_header for more information regarding this topic
- 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