Reputation: 41
I know how it can be done for Google Play Store (answer here), but i didn't manage to find a way for AppGallery. Thank you!
UPDATE #1
Using the answer below i partially solve this with this steps:
The response from the Querying App Information, have a lot of informations about the app including "versionNumber", but for me it doesn't provide the "versionNumber" (the single info i needed), because this parameter is optional. And now i am stuck again, because i don't understand what i need to change in order to receive this one.
If anyone knows how I can solve this, thank you very much for your help.
UPDATE #2
@shirley's comment was right. The issue has been fixed in their latest release, and it has been released this month.
Upvotes: 3
Views: 1959
Reputation: 34017
You can call the Querying App Information API (GET mode) to query the app details:
public static void getAppInfo(String domain, String clientId, String token, String appId, String lang) {
HttpGet get = new HttpGet(domain + "/publish/v2/app-info?appid=" + appId + "&lang=" + lang);
get.setHeader("Authorization", "Bearer " + token);
get.setHeader("client_id", clientId);
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse httpResponse = httpClient.execute(get);
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) {
BufferedReader br =
new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), Consts.UTF_8));
String result = br.readLine();
// Object returned by the app information query API, which can be received using the AppInfo object. For details, please refer to the API reference.
JSONObject object = JSON.parseObject(result);
System.out.println(object.get("ret"));
}
} catch (Exception e) {
}
}
They are mentioned here: Completing App Information, Querying App Information.
Upvotes: 5