Integrate Using API
If you want to integrate your app with App Upgrade using API. You will need to call just one API.
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 | You app name | Wallpaper app | Required |
app_version | You app name | 1.0.0 | Required |
platform | You platform name | android | Required |
environment | You environment name | production | Required |
app_language | You 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 will respond with the required checks. If found
is true that
means app is marked for upgrade.
If forceUpgrade
is true that means
app needs to force the user to update the app. If false than just show
a popup to user for upgrade but it's not mandatory.
This call can be made on start of the app or periodically to check for the upgrade is required or not.
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 provied 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.