Distributing Releases
In order to download the release, the release URL must contain license key as
key
query parameter or access token
in the header.# download file using license key
curl https://releases.cryptlex.com/v3/{ACCOUNT_ID}/{RELEASE_ID}/myapp.zip?key={LICENSE_KEY} \
-o="myapp.zip"
# download file using access token
curl -O -J -L https://releases.cryptlex.com/v3/{ACCOUNT_ID}/{RELEASE_ID}/myapp.zip \
-H "Authorization: Bearer {ACCESS_TOKEN}" \
-o="myapp.zip"
The license key must belong to the product for which the release was created and the access token must belong to any user who is associated with the license key of the product.
The external release files are not secured and hence don't require
key
query parameter for download.In order to detect whether an update is available for your product, you can either invoke the /v3/releases/update Web API endpoint or use
CheckReleaseUpdate()
LexActivator function.The following sample request checks whether a new release is available by comparing it with the provided release version.
get
https://api.cryptlex.com
/v3/releases/update
Check for an update
If an update is available it returns a
200
success response containing the download URL, else it will return a 204
empty response.The sample code for checking the release update is available on GitHub for all the languages in their sample files. The following sample code demonstrates it for C/C++.
void LA_CC SoftwareReleaseUpdateCallback(int status, Release* release, void* custom_data)
{
switch (status)
{
case LA_RELEASE_UPDATE_AVAILABLE:
printf("A new update is available for the app.\n");
printf("Release notes: %s", release->notes);
break;
case LA_RELEASE_UPDATE_AVAILABLE_NOT_ALLOWED:
printf("A new update is available for the app but it's not allowed.\n");
printf("Release notes: %s", release->notes);
break;
case LA_RELEASE_UPDATE_NOT_AVAILABLE:
printf("Current version is already latest.\n");
break;
default:
printf("Error code: %d\n", status);
}
}
int main()
{
int status;
// init code - SetProductId(), SetProductData()
// Ensure that platform, channel and version actually exist for the release
status = SetReleasePlatform("windows");
if (LA_OK != status)
{
// handle error
}
status = SetReleaseChannel("stable");
if (LA_OK != status)
{
// handle error
}
status = SetReleaseVersion("1.2.3.4");
if (LA_OK != status)
{
// handle error
}
status = CheckReleaseUpdate(SoftwareReleaseUpdateCallback, LA_RELEASES_ALL, data);
if (LA_OK != status)
{
printf("Error checking for software release update: %d", status);
}
}
The version format syntax in Cryptlex is
$MAJOR.$MINOR.$PATCH.$BUILD
. In case you want to ignore $PATCH
and $BUILD
releases in the update API endpoint you can pass the partial version too. The following table summarises the expected response by the
/v3/releases/update
API endpoint if it is invoked with version
query param set to the values in the first column:Version (Query Param) | Latest Version | Response (Status Code) |
1.2.3.5 | 1.2.3.5 | 204 |
1.2.3.4 | 1.2.3.5 | 200 |
1.2.3 | 1.2.3.4 | 204 |
1.2 | 1.2.3.4 | 204 |
Suppose your latest release version is
1.2.3.4
and you invoke the update API endpoint with version
query param having a value 1.2.3
, then it will return 204
status code indicating no update.In order to download the latest release of your product, you need to invoke the /v3/releases/latest endpoint to get the download URLs for the latest release.
The following sample request fetches the latest release details.
get
https://api.cryptlex.com
/v3/releases/latest
Download latest release
It returns a
200
success response containing the download URLs of the latest release.Last modified 1mo ago