3

Recently the hockey moved to app center and i want to download the latest version of android and iOS version on the fly using the API.

What I tried ?

checked the official swagger api-specs

1. @GET("/v0.1/apps/{owner_name}/{app_name}/recent_releases")
2. @GET("/v0.1/apps/{owner_name}/{app_name}/builds/{build_id}/downloads/{download_type}")

but the download url provided by the second url has a different host and it doesn't work.

4 Answers 4

3

This API:

@GET("/v0.1/apps/{owner_name}/{app_name}/builds/{build_id}/downloads/{download_type}")

is to download builds if you use the Build service from App Center. If you only use Distribute service, try one of these APIs to get the release details, which includes the download url:

https://openapi.appcenter.ms/#/distribute/releases_getLatestByUser https://openapi.appcenter.ms/#/distribute/releases_getLatestByDistributionGroup

Sign up to request clarification or add additional context in comments.

Comments

3

UPDATED

The api's has been changed, and the new api we can use is

@GET("/v0.1/public/sdk/apps/{app_secret}/releases/latest")
    fun latestRelease(@Header("X-API-Token") apiToken: String, @Path("app_secret") secret: String): Call<JsonObject>

offical swagger api

Comments

2

The API's changed, and /v0.1/public/sdk/apps/{app_secret}/releases/latest is no longer supported. you can use instead

https://api.appcenter.ms/v0.1/sdk/apps/{app_secret}/releases/latest

Another better option then you can easily get any version is to use

https://api.appcenter.ms/v0.1/apps/{owner_name}/{app_name}/releases/{release_id}

Get a release with id release_id or 'latest' to get the latest release that was distributed to the current user (from all the distribution groups).

Swagger

Comments

0

TL,DR: If the link of distribution source contains three parts you can get via releases_getLatestByDistributionGroup directly: owner_name, app_name and distribution_group_name. the value of install_url (or download_url) key is what you need.

Taking "Plus Messenger" source as example:

https://install.appcenter.ms/users/rafalense-70ux/apps/plus-release/distribution_groups/public

owner_name: "rafalense-70ux"

app_name: "plus-release"

distribution_group_name: "public"

So the link containing latest release metadata from the distgroup would be like:

https://install.appcenter.ms/api/v0.1/apps/rafalense-70ux/plus-release/distribution_groups/public/releases/latest


Most of openapi requires a token. If you want access assets without token, beside the method mentioned above, there is also a hidden API that allows to get all "public releases" in a certain distribution group:

api/v0.1/apps/{user}/{app}/distribution_groups/{dist}/public_releases

The API returns something like this:

[   
   {
        "id": 9,
        "short_version": "1.0",
        "version": "26",
        "origin": "appcenter",
        "uploaded_at": "2022-04-19T13:40:13.181Z",
        "mandatory_update": false,
        "enabled": true,
        "is_external_build": false
    },
]

The value of id key can be used on first api mentioned above, replace latest with the id should be enough.

This API might be similar to https://openapi.appcenter.ms/#/distribute/releases_listByDistributionGroup, while the latter needs an token to give you "not public" releases, in theory.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.