Question

This is a freebase mqlread query to get some id's about each film.

https://www.googleapis.com/freebase/v1/mqlread?query=[{ "name": null, "mid": null, "type": "/film/film", "/film/film/rottentomatoes_id": null, "/film/film/imdb_id": null }]&cursor

That works and returns this cursor.

=eNpVjMEKwjAQRH9HkdDZsNlNFhH_I_QQYgsFsdKgR7_dIII4lxlmmFcfW1s3oyKT5dUIGPOtm3pETiGMSysG9y1U2a5Ht3sudyMNGgXxtwXbDsnDl1jBAIRpjvhTdafPD6L7gRI6gezlcus8yDicRaYLMc9Qrkm5x8B4A72MKIs=

My problem is the subsequent call formulated by appending the cursor value which does not work. See below.

https://www.googleapis.com/freebase/v1/mqlread?query=[{ "name": null, "mid": null, "type": "/film/film", "/film/film/rottentomatoes_id": null, "/film/film/imdb_id": null }]&cursor=eNpVjMEKwjAQRH9HkdDZsNlNFhH_I_QQYgsFsdKgR7_dIII4lxlmmFcfW1s3oyKT5dUIGPOtm3pETiGMSysG9y1U2a5Ht3sudyMNGgXxtwXbDsnDl1jBAIRpjvhTdafPD6L7gRI6gezlcus8yDicRaYLMc9Qrkm5x8B4A72MKIs=

This gives

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "query is invalid: JSON parsing error.",
    "locationType": "other",
    "location": "parameters.query"
   }
  ],
  "code": 400,
  "message": "query is invalid: JSON parsing error."
 }
}

but all thats changed is the appendage of the cursor value.

Why would I get this sort of error in the circumstance and how would I fix it.

Was it helpful?

Solution

Some of your properties aren't unique. If you get only one value back, the query will work fine, but as soon as you hit a topic with multiple values, you'll get a non-unique error like this:

error: {
errors: [
{
domain: "global",
reason: "invalid",
message: "Unique query may have at most one result. Got 2",
locationType: "other",
location: "/film/film/rottentomatoes_id"
}
],
code: 400,
message: "Unique query may have at most one result. Got 2"
}

The error message is pretty specific. The offending property is the one for Rotten Tomatoes ID. If you switch your placeholder value from "null" to [] for this property to accommodate multiple values, the query will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top