Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ilhamlamp/cmty-upload-download-service
communtity upload download service
https://github.com/ilhamlamp/cmty-upload-download-service
cloudinary gin golang rabbitmq
Last synced: 2 days ago
JSON representation
communtity upload download service
- Host: GitHub
- URL: https://github.com/ilhamlamp/cmty-upload-download-service
- Owner: IlhamLamp
- License: mit
- Created: 2024-10-30T03:28:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-19T00:00:06.000Z (8 days ago)
- Last Synced: 2025-01-19T01:17:12.782Z (8 days ago)
- Topics: cloudinary, gin, golang, rabbitmq
- Language: Go
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **API Documentation: Media Service**
## **Endpoint**
### **POST** `/api/v1/auth/media/upload`
## **Headers**
| Header | Value | Description |
| --------------- | ------------------- | ------------------------------------------------- |
| `Authorization` | Bearer `` | Token autentikasi pengguna (wajib). |
| `Content-Type` | multipart/form-data | Header untuk mendukung pengunggahan file (wajib). |---
## **Request Body**
Body harus dikirimkan dalam format `multipart/form-data`.
| Parameter | Type | Description |
| --------- | -------- | --------------------------------------------- |
| `file` | `file` | File gambar yang akan diunggah (wajib). |
| `folder` | `string` | Nama folder tujuan di penyimpanan (opsional). |---
### **Example Request**
#### **Curl Command**
```bash
curl --location --request POST 'https://yourdomain.com/api/v1/auth/media/upload' \
--header 'Authorization: Bearer your_access_token' \
--form 'file=@"/path/to/your/image.jpg"' \
--form 'folder="profile_pictures"'
```---
## **Responses**
### **Success Response**
**HTTP Status Code:** `200 OK`
```json
{
"status": "success",
"message": "File uploaded successfully",
"data": {
"url": "https://yourstorage.com/path/to/image.jpg",
"public_id": "folder_name/image_id",
"size": "1024KB",
"type": "image/jpeg"
}
}
```| Field | Type | Description |
| ----------- | -------- | ----------------------------------------- |
| `url` | `string` | URL untuk mengakses gambar yang diunggah. |
| `public_id` | `string` | ID publik file di penyimpanan. |
| `size` | `string` | Ukuran file gambar. |
| `type` | `string` | Tipe MIME dari file yang diunggah. |---
### **Error Responses**
#### **401 Unauthorized**
**Reason:** Token autentikasi tidak valid atau tidak ada.
```json
{
"status": "fail",
"message": "Unauthorized. Please provide a valid token."
}
```## **Notes**
Pastikan token autentikasi (`Bearer Token`) valid sebelum mengakses endpoint ini.
---