Apps
Apps adalah entitas dasar di Capgo. Setiap app mewakili aplikasi Capacitor unik yang dapat Anda kelola dan perbarui melalui platform. API Apps memungkinkan Anda untuk membuat, mengambil, memperbarui, dan menghapus konfigurasi app.
Memahami Apps
Section titled “Memahami Apps”Sebuah app di Capgo mewakili aplikasi Capacitor Anda dan mencakup:
- App ID: Pengidentifikasi unik untuk aplikasi Anda
- Name: Nama yang dapat dibaca manusia dari aplikasi Anda
- Icons: Pengidentifikasi visual untuk app Anda di dashboard
- Configuration: Pengaturan yang mengontrol bagaimana pembaruan dikirimkan
- Ownership: Informasi akses organisasi dan pengguna
- Usage Statistics: Metrik tentang instalasi dan pembaruan
Best Practices
Section titled “Best Practices”- Naming Convention: Gunakan nama yang jelas dan dapat diidentifikasi untuk app Anda
- Security: Lindungi kunci API dan kredensial akses Anda
- Organization: Kelompokkan app terkait di bawah organisasi yang sama
- Monitoring: Periksa statistik dan performa app secara teratur
- Backup: Pertahankan cadangan konfigurasi untuk app kritis
Endpoints
Section titled “Endpoints”https://api.capgo.app/app/
Mengambil informasi tentang app Anda.
Query Parameters
Section titled “Query Parameters”page: Opsional. Nomor halaman untuk paginasilimit: Opsional. Jumlah hasil per halaman (default: 50)org_id: Opsional. Filter app berdasarkan ID organisasi. Jika tidak disediakan, mengembalikan app dari semua organisasi yang dapat diakses pengguna
Untuk mendapatkan app tertentu:
- Gunakan app ID di path URL:
https://api.capgo.app/app/:app_id
Response Type
Section titled “Response Type”interface App { app_id: string created_at: string | null default_upload_channel: string icon_url: string id: string | null last_version: string | null name: string | null owner_org: string retention: number transfer_history: Json[] | null updated_at: string | null user_id: string | null}Example Request
Section titled “Example Request”# Get all appscurl -H "authorization: your-api-key" \ "https://api.capgo.app/app/"
# Get apps from a specific organizationcurl -H "authorization: your-api-key" \ "https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"
# Get specific appcurl -H "authorization: your-api-key" \ "https://api.capgo.app/app/com.demo.app"Example Response
Section titled “Example Response”{ "data": [ { "app_id": "com.demo.app", "created_at": "2024-01-01T00:00:00Z", "default_upload_channel": "dev", "icon_url": "https://example.com/icon.png", "id": "550e8400-e29b-41d4-a716-446655440000", "last_version": "1.0.0", "name": "Demo App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8", "retention": 2592000, "transfer_history": null, "updated_at": "2024-01-01T00:00:00Z", "user_id": "6aa76066-55ef-4238-ade6-0b32334a4097" } ]}https://api.capgo.app/app/
Membuat app baru.
Request Body
Section titled “Request Body”interface CreateApp { app_id: string name: string icon?: string owner_org: string}Example Request
Section titled “Example Request”# Create new appcurl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "name": "My New App", "app_id": "com.demo.myapp", // id ini unik di Capgo. Tidak dapat digunakan ulang oleh akun manapun. "icon": "https://example.com/icon.png", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8" }' \ https://api.capgo.app/app/Success Response
Section titled “Success Response”{ "app_id": "My New App", "created_at": "2024-01-01T00:00:00Z", "default_upload_channel": "dev", "icon_url": "https://example.com/icon.png", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My New App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8", "retention": 2592000, "updated_at": "2024-01-01T00:00:00Z"}https://api.capgo.app/app/:app_id
Memperbarui app yang ada. App ID ditentukan di path URL.
Request Body
Section titled “Request Body”interface UpdateApp { name?: string icon?: string retention?: number}Example Request
Section titled “Example Request”curl -X PUT \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "name": "Updated App Name", "icon": "https://example.com/updated-icon.png", "retention": 45 }' \ https://api.capgo.app/app/com.demo.appSuccess Response
Section titled “Success Response”{ "app_id": "com.demo.app", "created_at": "2024-01-01T00:00:00Z", "default_upload_channel": "dev", "icon_url": "https://example.com/updated-icon.png", "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Updated App Name", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8", "retention": 45, "updated_at": "2024-01-01T00:00:00Z"}DELETE
Section titled “DELETE”https://api.capgo.app/app/:app_id
Menghapus app dan semua sumber daya terkait. App ID ditentukan di path URL. Gunakan dengan sangat hati-hati karena tindakan ini tidak dapat dibatalkan.
Example Request
Section titled “Example Request”curl -X DELETE \ -H "authorization: your-api-key" \ https://api.capgo.app/app/com.demo.appSuccess Response
Section titled “Success Response”{ "status": "ok"}Error Handling
Section titled “Error Handling”Skenario error umum dan responnya:
// App not found{ "error": "App not found", "status": "KO"}
// Duplicate custom ID{ "error": "Custom ID already in use", "status": "KO"}
// Invalid parameters{ "error": "Invalid app configuration", "status": "KO"}
// Permission denied{ "error": "Insufficient permissions to manage app", "status": "KO"}
// Organization access denied{ "status": "You do not have access to this organization"}Common Use Cases
Section titled “Common Use Cases”- Create New App
// Set up a new app{ "name": "Production App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"}- Update App Configuration
// Change app name and icon{ "name": "Rebranded App Name", "icon": "https://example.com/new-icon.png"}- Set Retention Policy
// Configure automatic bundle cleanup{ "retention": 30 // Keep bundles for 30 days}- Get Apps by Organization
# List all apps in a specific organizationcurl -H "authorization: your-api-key" \ "https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"Resource Management
Section titled “Resource Management”- Storage Optimization: Pantau penggunaan penyimpanan dan atur kebijakan retensi yang sesuai
- Organization: Kelompokkan app terkait di bawah satu organisasi
- Access Control: Kelola anggota tim mana yang dapat mengubah pengaturan app
- Backup Strategy: Cadangkan konfigurasi dan pengaturan app yang kritis