I'm using the 42Matters API to try and pull lists of apps from the Android Market Place. I'm looking at this API and it says under Request payload:
"Design your query in the App Market Explorer for Android and copy its JSON representation as POST request body to the Advanced Query API endpoint."
I took their sample query at the bottom and have been trying to figure out how I'm supposed to include it in my URL to retrieve the results. Here's what I have so far:
query.json
{
"query": {
"name": "Most Popular Apps",
"platform": "android",
"query_params": {
"sort": "number_ratings",
"from": 0,
"num": 100,
"i18n_lang": [],
"cat_int": [
"14",
"12"
],
"content_rating": [],
"sort_order": "desc",
"downloads_lte": "",
"downloads_gte": ""
}
}
}
PHP code:
<?php
$jsonQuery = fopen("query.json", "r") or die("Unable to open file!");
$query = fread($jsonQuery, filesize("query.json"));
var_dump(json_encode($query));
// var_dump(json_encode($jsonQuery));
$url = "https://42matters.com/api/1/apps/query.json?access_token=tokenNum&".urlencode(json_encode($query));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //don't print info to screen!
$result = json_decode(curl_exec($ch));
var_dump($result);
?>
The end result keeps returning a "Missing Query"