应用
复制包含安装步骤和该插件完整 Markdown 指南的配置 prompt。
App 是 Capgo 中的基础实体。每个 App 代表一个唯一的 Capacitor 应用,你可以通过平台对其进行管理和更新。Apps API 支持你进行 App 配置的增删改查。
了解应用
“了解 Apps”章节Capgo 中的 App 代表你的 Capacitor 应用,包含:
- App ID: 应用的唯一标识符
- 名称: 应用的可读名称
- 图标: 在 dashboard 中用于识别应用的视觉标识
- 配置: 控制更新分发方式的设置
- 所有权: 组织与用户访问权限信息
- 使用统计: 关于安装与更新的指标数据
最佳实践
标题为“最佳实践”的章节- 命名规范: 为你的应用使用清晰、易识别的名称
- 安全: 保护您的 API 密钥和访问凭据
- 组织: 将相关应用归到同一组织下
- 监控: 定期检查应用统计数据和性能
- 备份: 为关键应用维护配置备份
GET
“GET”章节https://api.capgo.app/app/
获取您的应用信息。
查询参数
标题为“查询参数”的章节page:选填。用于分页的页码limit: 可选。每页结果数(默认:50)org_id: 可选。通过组织 ID 筛选应用。若未提供,则返回用户有权访问的所有组织的 App
获取特定 App:
- 在 URL 路径中使用 App ID:
https://api.capgo.app/app/:app_id
响应类型
标题为“响应类型”的章节注意: last_version 指该 App 上传的最后一个 bundle(版本)。
interface App { app_id: string block_provider_infra_requests: boolean 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": [ { "block_provider_infra_requests": true, "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/成功响应
“成功响应”章节{ "block_provider_infra_requests": true, "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"}PUT
“PUT”章节https://api.capgo.app/app/:app_id
更新现有应用。应用 ID 在 URL 路径中指定。
请求体
标题为“请求体”的章节interface UpdateApp { block_provider_infra_requests?: boolean name?: string icon?: string retention?: number}请求示例
标题为“请求示例”的章节curl -X PUT \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "block_provider_infra_requests": true, "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", "block_provider_infra_requests": true, "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"}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"}错误处理
“错误处理”章节所有错误均采用以下文档中描述的标准错误格式: API 概览.
常见的错误场景及其响应:
// Missing or invalid API key (HTTP 401){ "error": "invalid_apikey", "message": "Invalid apikey", "moreInfo": {}}
// app_id is not a reverse-domain identifier{ "error": "invalid_app_id", "message": "App ID must be a reverse domain string", "moreInfo": { "app_id": "my app" }}
// The API key has no access to this app (HTTP 401){ "error": "cannot_access_app", "message": "You can't access this app", "moreInfo": { "app_id": "com.example.app" }}
// Creating an app in an organization the key cannot write to (HTTP 403){ "error": "cannot_access_organization", "message": "You can't access this organization", "moreInfo": { "org_id": "046a36ac-e03c-4590-9257-bd6c9dba9ee8" }}
// Retention above the two-year limit on update{ "error": "retention_to_big", "message": "Retention cannot be bigger than 63113903 (2 years)", "moreInfo": { "retention": 99999999 }}常见用例
“常见用例”章节- 创建新 App
// Set up a new app{ "name": "Production App", "owner_org": "046a36ac-e03c-4590-9257-bd6c9dba9ee8"}- 更新 App 配置
// 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}- 按组织获取 App
# 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 继续
“从应用继续”章节如果你正在使用 应用 要规划 dashboard 和 API 操作,请将其连接到 API 概览 关于 API Overview 中的实现细节, 简介 关于 Introduction 中的实现细节, API 密钥 有关 API Keys 的实现细节, 设备 有关 Devices 的实现细节,以及 Bundle 有关 Bundles 中的实现细节。