应用程序
复制一个包含安装步骤和本插件的完整Markdown指南的设置提示.
应用程序是Capgo的基本实体。每个应用程序代表一个独特的Capacitor应用程序,通过平台可以管理和更新。应用程序API允许您创建、检索、更新和删除应用程序配置.
了解应用程序
标题:了解应用程序一个应用在 Capgo 中代表您的 Capacitor 应用程序,并包含:
- App ID: 该应用程序的唯一标识符
- Name: 该应用程序的可读名称
- Icons: 应用程序在仪表板中的视觉标识符
- Configuration: 控制更新如何分发的设置
- Ownership: 组织和用户访问信息
- Usage Statistics: 安装和更新的指标
最佳实践
关于最佳实践的部分- 命名约定: 为您的应用程序使用清晰、可识别的名称
- 安全: 保护您的 API 密钥和访问凭证
- 组织: 将相关应用程序分组到同一个组织
- 监控: 定期检查应用程序统计数据和性能
- 备份: 保持关键应用的配置备份
Endpoints
Section titled “Endpoints”https://api.capgo.app/app/
获取有关您的应用的信息。
Query Parameters
Section titled “Query Parameters”page: 可选。分页的页码limit: 可选。每页显示的结果数量(默认值:50)org_id: 可选。按组织 ID 过滤应用。如果未提供,则返回用户有访问权限的所有组织的应用
For getting a specific app:
- 使用应用 ID 在 URL 路径中:
https://api.capgo.app/app/:app_id
响应类型
标题:响应类型注意: last_version 指的是应用程序上载的最后一个包(版本)。
interface App { app_id: string created_at: string | null default_upload_channel: string icon_url: string id: string | null last_version: string | null // last bundle (version) name name: string | null owner_org: string retention: number transfer_history: Json[] | null updated_at: string | null user_id: string | null}示例请求
标题:示例请求# 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"示例响应
标题:示例响应{ "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" } ]}POST
POST部分https://api.capgo.app/app/
创建一个新应用。
请求体
请求体部分interface CreateApp { app_id: string name: string icon?: string owner_org: string}示例请求
示例请求部分# 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", // this id is unique in Capgo This cannot be reused by any account. "icon": "https://example.com/icon.png", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8" }' \ https://api.capgo.app/app/{ "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
更新现有应用。应用 ID 在 URL 路径中指定。
interface UpdateApp { name?: string icon?: string retention?: number}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.app成功响应
成功响应部分{ "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
删除部分https://api.capgo.app/app/:app_id
删除应用和所有相关资源。应用ID在URL路径中指定。请谨慎使用此操作,因为它无法被撤销。
示例请求
示例请求部分curl -X DELETE \ -H "authorization: your-api-key" \ https://api.capgo.app/app/com.demo.app成功响应
成功响应部分{ "status": "ok"}错误处理
标题:错误处理常见错误场景和响应:
// 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"}常见用例
标题:常见用例- 创建新应用
// Set up a new app{ "name": "Production App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"}- 更新应用配置
// Change app name and icon{ "name": "Rebranded App Name", "icon": "https://example.com/new-icon.png"}- 设置保留策略
// Configure automatic bundle cleanup{ "retention": 30 // Keep bundles for 30 days}- 按组织获取应用
# List all apps in a specific organizationcurl -H "authorization: your-api-key" \ "https://api.capgo.app/app/?org_id=046a36ac-e03c-4590-9257-bd6c9dba9ee8"资源管理
标题:资源管理- 存储优化: 监控存储使用情况并设置适当的保留策略
- 组织: 将相关应用分组到一个单独的组织
- 访问控制: 管理可以修改应用设置的团队成员
- 备份策略: 备份关键应用配置和设置
从 Apps 继续
标题:从 Apps 继续如果您正在使用 Apps 来规划仪表板和API操作,连接它与 API概览 查看API概览中的实施细节 介绍 查看介绍中的实施细节 API密钥 对于在API Keys中的实现细节 设备 对于在设备中的实现细节,并 捆绑包 对于在捆绑包中的实现细节。