Home > Uncategorized > Read #Android Play Store data with C# via @appTweak

Read #Android Play Store data with C# via @appTweak

n9dzneni_400x400

The AppTweak API allows up to 100 queries against the Google Play Store for free. Which is a great free trial. I was looking to import a few apps ad-hoc into http://www.androidappstore.com.cn/en/ – and instead of re-importing the database, this was a handy way.

So, here’s how I did it using C# (I’ve omitted the license key, you can get one yourself!).

WebClient wc = new WebClient();
wc.Headers.Add(“X-Apptweak-Key”, “{{Your Key}}“);
wc.Encoding = Encoding.UTF8;
var strJson = wc.DownloadString(“https://api.apptweak.com/android/applications/uk.org.regcheck.app.json”);
var app = JavascriptDeserialize<RootObject>(strJson);

Note that in the above example uk.org.regcheck.app is the package name of the app.

The JavascriptDeserialize function is defined as follows, – it converts the JSON to a strongly typed object

public static T JavascriptDeserialize<T>(string json)
{
var jsSerializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
return jsSerializer.Deserialize<T>(json);
}

Then “RootObject”, and it’s members are defined as follows;

public class Developer
{
public string name { get; set; }
public string email { get; set; }
public string website { get; set; }
}

public class Version
{
public string version { get; set; }
public string release_notes { get; set; }
public string release_date { get; set; }
}

public class Current
{
public string discovered_at { get; set; }
public string confirmed_at { get; set; }
public int data { get; set; }
}

public class History
{
public string discovered_at { get; set; }
public string confirmed_at { get; set; }
public int data { get; set; }
}

public class Size
{
public Current current { get; set; }
public List<History> history { get; set; }
}

public class StoreInfo
{
public List<Version> versions { get; set; }
public string icon { get; set; }
public List<string> genres { get; set; }
public string title { get; set; }
public string description { get; set; }
public string short_description { get; set; }
public string price { get; set; }
public List<string> permissions { get; set; }
public List<string> screenshots { get; set; }
public List<object> videos { get; set; }
public Size size { get; set; }
public string slug { get; set; }
}
public class Ratings
{
public double average { get; set; }
public int count { get; set; }

}

public class Us
{
public string en { get; set; }
}

public class Gb
{
public string en { get; set; }
}

public class AppInfoUpdater
{
public Us us { get; set; }
public Gb gb { get; set; }
}

public class RobotsRunTime
{
public AppInfoUpdater app_info_updater { get; set; }
}

public class SchemaVersion
{
public int app_info_updater { get; set; }
}

public class Content
{

public string application_id { get; set; }
public Developer developer { get; set; }
public StoreInfo store_info { get; set; }
public Ratings ratings { get; set; }
public RobotsRunTime _robots_run_time { get; set; }
public SchemaVersion _schema_version { get; set; }
public List<object> reviews { get; set; }
public List<object> rankings { get; set; }
public List<object> country_rankings { get; set; }
public string country_code { get; set; }
public string language { get; set; }
}

public class Params
{
public string country { get; set; }
public string language { get; set; }

public string id { get; set; }
public string format { get; set; }
}

public class Request
{
public string path { get; set; }
public string store { get; set; }
public Params @params { get; set; }
public string performed_at { get; set; }
}

public class Content2
{
}

public class Metadata
{
public Request request { get; set; }
public Content2 content { get; set; }
}

public class RootObject
{
public Content content { get; set; }
public Metadata metadata { get; set; }
}
}

Advertisements
Categories: Uncategorized
  1. coderwill
    June 16, 2017 at 11:06 am

    Hello i want to rating from the google play store and show in my web portal using c# aps.net mvc.? any idea about this then please let me know how can do that.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: