20

is there a way to query the play store for the version of an app without the need for user-credentials. I am aware of this unofficial API:

http://code.google.com/p/android-market-api/

but I don't want to rely on user credentials - I can visit the google play sites in incognito mode via chrome also - so it must be possible somehow. But I found no way and I don't want to fallback on scraping ;-)

ligi
  • 37,862
  • 40
  • 132
  • 234

4 Answers4

13

Found a suitable API via G+: this is the API: https://androidquery.appspot.com

example call: https://androidquery.appspot.com/api/market?app=org.ligi.fast

and this wrapper/code: https://github.com/androidquery/androidquery

ligi
  • 37,862
  • 40
  • 132
  • 234
2

Google Play does not provide any official APIs for retrieving metadata. You could however, check the unofficial API at http://code.google.com/p/android-market-api/.

Specifically, take a look at the Wiki page HowToSearchApps. The response to the query contains version information:

Your query will be something like:

String query = "maps";
AppsRequest appsRequest = AppsRequest.newBuilder()
                                .setQuery(query)
                                .setStartIndex(0).setEntriesCount(10)
                                .setWithExtendedInfo(true)
                                .build();

session.append(appsRequest, new Callback<AppsResponse>() {
         @Override
         public void onResult(ResponseContext context, AppsResponse response) {
                  // Your code here
                  // response.getApp(0).getCreator() ...
                  // see AppsResponse class definition for more infos
         }
});

Your response will be of the format:

{
  "app": [
    {
      "rating": "4.642857142857143",
      "title": "Ruboto IRB",
      "ratingsCount": 14,
      "creator": "Jan Berkel",
      "appType": "APPLICATION",
      "id": "9089465703133677000",
      "packageName": "org.jruby.ruboto.irb",
      "version": "0.1",
      "versionCode": 1,
      "creatorId": "\"Jan Berkel\"",
      "ExtendedInfo": {
        "category": "Tools",
        "permissionId": [
...

Then of course you may use a JSON Parser or do a string search.

Dheeraj Bhaskar
  • 17,971
  • 9
  • 63
  • 65
  • yea but I need user credentials to build the session if I have read the documentation right? – ligi Jan 23 '13 at 00:30
  • @ligi not really, this is a RESTful interface, so any session id/session needed will be provided back to you in the response. Here, it doesn't seem like you need one. – Dheeraj Bhaskar Jan 23 '13 at 00:36
  • already been there, but the session object is not defined - when reading how to create this I noticed I need user credentials and this is a no go for my use-case – ligi Jan 23 '13 at 00:39
  • @DheB just verified that I have understood the doc correct and unfortunately I did - so I end up with java.lang.RuntimeException: Unable to create application org.ligi.gobandroid_hd.GobandroidApp: com.google.protobuf.UninitializedMessageException: Message missing required fields: authSubToken when using the API without credentials – ligi Jan 23 '13 at 00:55
  • @ligi I just looked it over myself. You're right that you can use the incognito mode and browse the site, but Google seems to have `chosen` to make credentials `required` to prevent their api being abused/flooded with requests. – Dheeraj Bhaskar Jan 23 '13 at 00:58
  • in incognito mode should be no credential so it cannot be required – ligi Jan 23 '13 at 01:01
  • @ligi what you're accessing in incognito mode is a webpage and this is an api call. These two are managed separately. – Dheeraj Bhaskar Jan 23 '13 at 01:03
  • right - and now please read my original question again and you know why I cannot accept your answer – ligi Jan 23 '13 at 01:09
0

Also check out: www.playstoreapi.com

It's unofficial but easy to use (free for non commercial use). you can get data about apps, search the play store and get top charts data. from their documentation section:

Node.js:

var request     = require('request');
var apiKey      = 'wij5czxu3mxkzkt9'; // your API key
var packageName = 'com.whatsapp';     // package Name, e.g. com.whatsapp for WhatsApp

var url = 'http://api.playstoreapi.com/v1.1/apps/' + packageName + '?key=' + apiKey;

request({
    url: url,
    json: true
    }, function (error, response, body) {
    if (!error && response.statusCode === 200) {
        console.log(body) // Print the json response
    }
});

HTML/JS:

<html>
<head>
<body>
<p></p>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

  <script>

  var apiKey = 'wij5czxu3mxkzkt9'; // your API key
  var app    = 'com.whatsapp';     // package com.whatsapp for WhatsApp

  var url = 'http://api.playstoreapi.com/v1.1/apps/' + app + '?key=' + apiKey;

  $.getJSON(url).done(function(appDetails) {
    $('p:last').html(JSON.stringify(appDetails));
  });

  </script>
</body>
</head>
<html>

Python:

import urllib2
import json

packageName = 'com.whatsapp'      # package com.whatsapp for WhatsApp
apiKey      = 'wij5czxu3mxkzkt9'  # your API key

url = 'http://api.playstoreapi.com/v1.1/apps/{0}?key={1}'

response = urllib2.urlopen(url.format(packageName, apiKey))

data = json.load(response)   
print data

C# .NET:

string apiKey = "wij5czxu3mxkzkt9"; // your API key
string app    = "com.whatsapp";     // package com.whatsapp for WhatsApp

string url = "http://api.playstoreapi.com/v1.1/apps/{0}?key={1}";

using (var webClient = new System.Net.WebClient()) {
    string jsonString = webClient.DownloadString(string.Format(url, app, apiKey));
}
orcaman
  • 5,791
  • 8
  • 48
  • 66
0

Bear in mind that nowadays a lot of apps have multiple versions running. For those apps with one version you can try 42matters Lookup API, it should give you the correct version.

Ivan Delchev
  • 412
  • 6
  • 10
  • Interesting but really expensive – ligi Apr 01 '16 at 15:46
  • It is a paid api and it is not cheap. I would use jsoup instead: http://stackoverflow.com/questions/25201349/programmatically-check-play-store-for-app-updates – jiahao Jun 30 '16 at 11:55