Apps
Apps是Capgo中的基础实体。每个应用程序代表一个独特的Capacitor应用程序,您可以通过平台进行管理和更新。Apps API允许您创建、检索、更新和删除应用程序配置。
理解Apps
Section titled “理解Apps”Capgo中的应用程序代表您的Capacitor应用程序,包括:
- App ID:应用程序的唯一标识符
- Name:应用程序的可读名称
- Icons:仪表板中应用程序的视觉标识符
- Configuration:控制更新交付方式的设置
- Ownership:组织和用户访问信息
- Usage Statistics:关于安装和更新的指标
- 命名约定:为您的应用程序使用清晰、可识别的名称
- 安全性:保护您的API密钥和访问凭据
- 组织:将相关应用程序分组到同一组织下
- 监控:定期检查应用程序统计信息和性能
- 备份:维护关键应用程序的配置备份
https://api.capgo.app/app/
检索有关您的应用程序的信息。
page:可选。分页的页码limit:可选。每页结果数(默认值:50)org_id:可选。按组织ID筛选应用程序。如果未提供,则返回用户有权访问的所有组织的应用程序
获取特定应用程序:
- 在URL路径中使用应用程序ID:
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/
创建新应用程序。
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", // 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/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
更新现有应用程序。应用程序ID在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
删除应用程序及所有相关资源。应用程序ID在URL路径中指定。请极其谨慎使用,因为此操作无法撤消。
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"}常见错误场景及其响应:
// 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"}- 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"- 存储优化:监控存储使用情况并设置适当的保留策略
- 组织:将相关应用程序分组到单个组织下
- 访问控制:管理哪些团队成员可以修改应用程序设置
- 备份策略:备份关键应用程序配置和设置