Application of mqlread cursor leads to non-unique error - freebase

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.

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.

Related

Q: Google Calendar API, Foreground color

I am currently working with the google calendar API and and have ran into an issue.
I can't seem to update (or patch) a calendarList's foreground color.
Even when working directly with their API at:
https://developers.google.com/calendar/v3/reference/calendarList/patch
With both queries, I have colorRgbFormat set to true, and these are the only values I provide.
This input works fine:
{
"backgroundColor": "#ac725e"
}
Where this input:
{
"backgroundColor": "#ac725e",
"foregroundColor": "#c1c1c1"
}
Gives me the following error:
400 bad request:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid foreground color."
}
],
"code": 400,
"message": "Invalid foreground color."
}
}
Any ideas?
I have tried using similar color format that is needed for ColorId, AKA "1", but that also gives me a bad request error.
What am I missing or doing wrong?
After doing trial and error, I found out that the foregroundColor is limited only to black(#000000) and white (#FFFFFF).
Example:
Reference:
CalendarList

Google calendar RRULE fails when updating but not when initially creating calendar entry

I already have an event entry that I created from my custom calendar with the following RRULE
FREQ=WEEKLY;DTSTART=20201203T090000;INTERVAL=2;BYDAY=TH;EXDATE:20201203T090000
When I update the event without changing the rrule I get an error
Error Message: Google_Service_Exception: { "error": { "errors": [ { "domain": "global", "reason": "invalid", "message": "Invalid recurrence rule." } ], "code": 400, "message": "Invalid recurrence rule." } }
The only thing I can think of is that this rrule has dates in the past. Can anyone confirm that this would be the issue?
FREQ=WEEKLY;DTSTART=20201203T090000;INTERVAL=2;BYDAY=TH;EXDATE:20201203T090000 is not a valid recurrence rule. With all the invalid parts removed the rule would look like this:
FREQ=WEEKLY;INTERVAL=2;BYDAY=TH
DTSTART and EXDATE are separate properties.

/film/film/runtime always returns null

Whenever I try to query for the length of a film I get lists of null. The query I use is directly from the "Build query" button on their site and looks like this:
[{
"id": null,
"name": null,
"type": "/film/film",
"/film/film/runtime": []
}]
Ufortunately all the responses I get look like this:
{
"name": "4D Man",
"type": "/film/film",
"/film/film/runtime": [
null
],
"id": "/en/4d_man"
}
I can hover over the links you can see on the query page and see the runtime (in this case 85 minutes) but as you can see all I get from the query is null. This may be a Freebase bug, but any help is appreciated. Thank you.
There's not a single runtime of a film, the same film can have different runtimes (original version, director's cut, etc...) Freebase use the film_cut type to contain the different runtimes of a movie
You can use this query to get the runtimes:
[{
"id": null,
"name": null,
"/film/film/runtime": [{
"runtime": null
}]
}]
Tune this query to your needs, you may need type_of_film_cut or film_release_region.

What is the issue in the Google map engine Query

i need to query some data with where clause
as per the API google map engine i have request as below.
https://www.googleapis.com/mapsengine/v1/tables/14538994882799551513-11853667273131550346/features?where=gx_id%3D900
for the above URL it says BAD REQUEST where=gx_id=900
and the response is
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "The value is invalid.",
"locationType": "parameter",
"location": "query"
}
],
"code": 400,
"message": "The value is invalid."
}
}
Please suggest me what is wrong in this URL
You use a Number in your query, but the particular gx_id seems to be of type String.
Enclose the Number with single-quotes:
https://www.googleapis.com/mapsengine/v1/tables/14538994882799551513-11853667273131550346/features?where=gx_id%3D%27900%27
Also, you don't have to worry about creating and keeping track of your ID's. the API says you need to include gx_id only to make sure that no Feature is sent twice.
Therefore, you can just throw in a string representing your system's current time for example.

How to search freebase for given names

Context: I am geek but brand new to the Freebase APIs.
I found this page describing Given Name type on Freebase and have tried to query it and am meeting with frustration. I have tried:
[{
"domain": "/base/givennames",
"given_name": null
}]
which gives a "Type /type/object does not have property domain" error and
[{
"type": "/givennames",
"given_name": null
}]
which gives an "Unable to load schema for /givennames" error.
I am guessing that I am missing something important on the page describing the type. Any assistance is appreciated.
Matthew
The "Build Query" menu option on the far right hand side of the schema page is a good way to get started with queries. In this case you want something like this:
[{
"id": null,
"name": null,
"type": "/base/givennames/given_name"
}]

Resources