メイン コンテンツにスキップ

APIのアップデートを続けてくださいエンドポイント

GitHub

codeの例は次のとおりです。

interface AppInfos {
version_name: string
version_build: string
version_os: string
custom_id?: string
is_prod?: boolean
is_emulator?: boolean
plugin_version: string
platform: string
app_id: string
device_id: string
}
export const handler: Handler = async (event) => {
const body = JSON.parse(event.body || '{}') as AppInfos
const {
platform,
app_id,
version_os,
device_id,
version_name,
version_build,
plugin_version,
} = body
console.log('update asked', platform,
app_id,
version_os,
device_id,
version_name,
version_build,
plugin_version)
if (version_name === '1.0.0') {
return {
version: '1.0.1',
url: 'https://apiurl.com/mybuild_101.zip',
checksum: 'sha256_checksum_of_bundle',
}
}
else if (version_name === '1.0.1') {
return {
version: '1.0.2',
url: 'https://apiurl.com/mybuild_102.zip',
checksum: 'sha256_checksum_of_bundle',
}
}
else {
return {
message: 'Error version not found'
version: '',
url: '',
}
}
}

非暗号化のバンドル用 非暗号化のバンドル用, __CAPGO_KEEP_0__

{
"version": "1.0.2",
"url": "https://apiurl.com/mybuild_102.zip",
"checksum": "sha256_checksum_of_bundle"
}

の場合 For暗号化されたバンドル

{
"version": "1.0.2",
"url": "https://apiurl.com/mybuild_102.zip",
"checksum": "encrypted_checksum_from_encrypt_command",
"session_key": "ivSessionKey_from_encrypt_command"
}

Copy to __CAPGO_KEEP_0__ message エラーがなければ、 error:

{
"message": "Version not found",
"error": "The backend crashed",
"version": "1.0.2",
}
  • checksum: バンドル zip ファイルの SHA256 ハッシュで整合性の確認
  • session_key: 必須は暗号化されたバンドルにのみ適用されます - これは ivSessionKey encryptコマンドによって返される
  • version: バージョン識別子 - semver形式
  • url: ダウンロードできるバンドルのHTTPS URL

互換性のあるバンドルを作成し、チェックサムを生成する方法を学ぶには、 自動更新ドキュメント.

暗号化されたバンドルについては、 暗号化されたバンドルに関するドキュメント 暗号化フローを完全に説明している

Update API エンドポイントから続ける

「Update API エンドポイントから続ける」セクション

Capgoを使用している場合 Update API エンドポイントから続ける CI/CDの自動化を計画する場合、Capgoを @capgo/capacitor-updaterを使用 Capgoを使用して、@capgo/capacitor-updaterのネイティブ機能 Capgo CI/CD Capgo CI/CDを使用して、製品ワークフロー Capgo Native Builds Capgo Native Buildsを使用して、製品ワークフロー Capgo Integrations 製品ワークフローにおけるCapgo統合、および CI/CD統合 CI/CD統合の実装詳細について