1

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"

Andrew
  • 3,501
  • 8
  • 35
  • 54

1 Answers1

0

In the meantime you might have figured out the issue (send data as POST and don't need to json_encode it) but please have a look at our updated documentations at this link:

https://42matters.com/docs/app-market-data/android/apps/advanced-query-api

I hope this helps, otherwise feel free to get in touch with me. I have lots of experience in the mobile app business so I'm sure I'll be able to point you in the right direction.

Best regards,

Andrea

agirardello
  • 2,895
  • 22
  • 22