Mise à jour API Endpoint
Here is an Exemple of code in JavaScript to send an Mise à jour to the plugin
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: '', } }}Response Format
Section titled “Response Format”For non-Chiffré Bundles, your endpoint should return:
{ "version": "1.0.2", "url": "https://apiurl.com/mybuild_102.zip", "checksum": "sha256_checksum_of_bundle"}For Chiffré Bundles, you also need to include the session key:
{ "version": "1.0.2", "url": "https://apiurl.com/mybuild_102.zip", "checksum": "encrypted_checksum_from_encrypt_command", "session_key": "ivSessionKey_from_encrypt_command"}And if no update or error, add the message key and optionally an error:
{ "message": "Version not found", "error": "The backend crashed", "version": "1.0.2",}Field Descriptions
Section titled “Field Descriptions”checksum: SHA256 hash of your bundle zip file for integrity verificationsession_key: Required only for encrypted bundles - this is theivSessionKeyreturned by the encrypt commandversion: Version identifier in semver formaturl: HTTPS URL where the bundle can be downloaded
Bundle Creation
Section titled “Bundle Creation”To learn how to Créer compatible Bundles and generate checksums, see the [Auto Mise à jour Documentation](/docs/plugin/self-hosted/auto-Mise à jour/#generating-Bundle-checksum).
For Chiffré Bundles, see the Chiffré Bundles Documentation which explains the Terminé Chiffrement workflow.