Integrate Using API
If you want to integrate your app with App Upgrade using API. You will need to call just one API.
This version-check API uses your project's x-api-key. To create, update, list, or delete versions from CI/CD pipelines and trusted backend services, use a Personal Access Token.
API Contract:
This API is used for checking the app version is marked for upgrade or not.
Request Headers
| Header Name | Description | Example |
|---|---|---|
| x-api-key | x-api-key for your project | MDNmNmZkNDEtNmNkMi00NzY3LThjOWEtYWYxMGFjZWQ0ZjI2 |
You can find the x-api-key in Accounts tab.
Request Params
| Param Name | Description | Example | Required |
|---|---|---|---|
| app_name | Your app name | Wallpaper app | Required |
| app_version | Your app name | 1.0.0 | Required |
| platform | Your platform name | android | Required |
| environment | Your environment name | production | Required |
| app_language | Your app language | en | Optional |
Request Example:
curl --location --request GET 'https://appupgrade.dev/api/v1/versions/check?app_name=Wallpaper app&app_version=1.0.0&platform=android&environment=production&app_language=en' \
--header 'x-api-key: MDNmNmZkNDEtNmNkMi00NzY3LThjOWEtYWYxMGFjZWQ0ZjI2'
Response Example:
- When a version is matched.
{
"found": true,
"forceUpgrade": true,
"message": "Update message."
"query": {
"app_name": "Wallpaper app",
"app_version": "1.0.0",
"platform": "android",
"environment": "production",
"app_language": "en" //optional if passed in query param.
}
}
- When a version is not matched/found.
{
"found": false,
"query": {
"app_name": "Wallpaper app",
"app_version": "1.0.0",
"platform": "android",
"environment": "production",
"app_language": "en" //optional if passed in query param.
}
}
The API responds with the required checks. If found is true, the app is marked
for upgrade.
If forceUpgrade is true, the app must force the user to update. If false, show
an upgrade popup, but do not make it mandatory.
This call can be made when the app starts or periodically to check whether an upgrade is required.
Localization
You can use the app_language parameter to localize the update message. If you have created localized messages in dashboard. The message field in response will have the localized update message. If a localization not found for the provided app_language field the default update message will be returned.
Refer Localization for instructions on how to create localized messages.
Custom Attributes
You can include custom attributes in the request body. For example ``` { "app_name": "Wallpaper app", "app_version": "1.0.0", "platform": "android", "environment": "production, "customAttributes": { "os-version": 12, // os version for example android 12 or ios 15 "user-country": 'US', // User's country "user-group": 'beta' // User's group } }
Refer Custom Attributes for instructions on how to use custom attributes.
