get cursor from MQL query, Freebase - freebase

I am trying to get the 'cursor' value returned in a MQL query by following this example. Though my attempt produces the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "cursor is invalid.",
"locationType": "other",
"location": "parameters.cursor"
}
],
"code": 400,
"message": "cursor is invalid."
}
}

In the new API, the starting value for the cursor parameter is null, not the value true like before. Try this

Docs here
http://wiki.freebase.com/wiki/MQL_Read_Service

Related

LinkediIn API V2 - 500 intermittent error when fetching organizational entities data using projections

I'm trying to retrieve details for the companies where a user is an administrator using the request and projections bellow.
Sometimes it fails with a 500 error code and returns an unknown reason message. If I try again after a long time, it usually works.
Sample request
GET "https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(*,organizationalTarget~(localizedName,vanityName,logoV2(original~:playableStreams),id)))"
Sample response
{
"elements": [{
"role": "ADMINISTRATOR",
"roleAssignee": "urn:li:person:dV",
"state": "REVOKED",
"organizationalTarget!": {
"message": "URN Resolution failed for unknown reasons.: com.linkedin.r2.RemoteInvocationException: GatewayException{_serviceErrorCode=null}",
"status": 500
},
"organizationalTarget": "urn:li:organization:1"
}, {
"role": "ADMINISTRATOR",
"roleAssignee": "urn:li:person:dV",
"state": "APPROVED",
"organizationalTarget!": {
"message": "URN Resolution failed for unknown reasons.: com.linkedin.r2.RemoteInvocationException: GatewayException{_serviceErrorCode=null}",
"status": 500
},
"organizationalTarget": "urn:li:organization:9"
}]
}
Why is this error happening? Is there any workaround to get this information without falling into the same error?
Thanks!

Firebase Firestore REST POST Request - Query and Filter using structured query

URL:
https://firestore.googleapis.com/v1beta1/projects/projectname/databases/(default)/documents/:runQuery
POST buffer:
{ "structuredQuery": {"from": [{"collectionId": "example","allDescendants": true}],"where": {"fieldFilter": {"field": {"fieldPath": "Invoiceno"},"op": EQUAL,"value": {"stringValue": "1"}}}}}
Response:
[{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"{ \"structuredQuery\": {\"from\": [{\"collectionId\": \"example\",\"allDescendants\": true}],\"where\": {\"fieldFilter\": {\"field\": {\"fieldPath\": \"Invoiceno\"},\"op\": EQUAL,\"value\": {\"stringValue\": \"1\"}}}}}\": Cannot bind query parameter. Field '{ \"structuredQuery\": {\"from\": [{\"collectionId\": \"example\",\"allDescendants\": true}],\"where\": {\"fieldFilter\": {\"field\": {\"fieldPath\": \"Invoiceno\"},\"op\": EQUAL,\"value\": {\"stringValue\": \"1\"}}}}}' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"{ \"structuredQuery\": {\"from\": [{\"collectionId\": \"example\",\"allDescendants\": true}],\"where\": {\"fieldFilter\": {\"field\": {\"fieldPath\": \"Invoiceno\"},\"op\": EQUAL,\"value\": {\"stringValue\": \"1\"}}}}}\": Cannot bind query parameter. Field '{ \"structuredQuery\": {\"from\": [{\"collectionId\": \"example\",\"allDescendants\": true}],\"where\": {\"fieldFilter\": {\"field\": {\"fieldPath\": \"Invoiceno\"},\"op\": EQUAL,\"value\": {\"stringValue\": \"1\"}}}}}' could not be found in request message."
}
]
}
]
}
}
]
I have given this for POST REST function, but i am unable to get the data.
I believe the issue is in your fieldFilter, where you are using the op as EQUAL and it should be "EQUAL" with quotes, try changing it to the following and it should work:
"fieldFilter":
{
"field":
{
"fieldPath": "Invoiceno"
},
"op": "EQUAL",
"value": {"stringValue": "1"}
}
I discover you need to create an index on root Document.
So when you run the query all is fine.
https://firestore.googleapis.com/v1/projects/{projectId}/databases/(default)/documents:runQuery
"fieldFilter":
{
"field":
{
"fieldPath": "Invoiceno"
},
"op": "EQUAL",
"value": {"stringValue": "1"}
}{ "structuredQuery": {"from": [{"collectionId": "example","allDescendants": true}],"where": {"fieldFilter": {"field": {"fieldPath": "Invoiceno"},"op": EQUAL,"value": {"stringValue": "1"}}}}}

Why I got the parseerror error when creating an event

With the Google Calendar API I have the following error when creating an event. "code": 400, "message": "Parse Error"
I'm using PowerBuilder 2017 and Rest Object
Header : "content-type:application/json; charset=utf-8"
Url : POST
https://www.googleapis.com/calendar/v3/calendars/3uhk2ncgaugdu6lmegfkb7rnrk#group.calendar.google.com/events
Data :
{"summary":"[CARINE VĂ©ronique] A","description":"","visibility":"public","location":"","start":{"dateTime":"2020-07-03T15:30:00+02:00","timeZone":"America/Los_Angeles"},"end":{"dateTime":"2020-07-03T16:00:00+02:00","timeZone":"America/Los_Angeles"}}
Response : 400
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error"
}
],
"code": 400,
"message": "Parse Error"
}
}
Have any suggestions?
Regards
Thierry
Regard

Error thrown during batchUpdate for createImageRequest

While using Google Slides API request for batchUpdate request (ref: https://developers.google.com/slides/reference/rest/v1/presentations/request#createimagerequest), even when all images are valid, the library still throws this error, and it has been quite difficult to debug what exactly went wrong. I ensured image to be valid and matched requirements through Google API specs.
If there are better ways to catch specific details, please mention.
Error: Invalid requests[224].updatePageProperties: There was a problem retrieving the specified image.
at Request.DefaultTransporter.wrapCallback_ [as _callback] (/path/to/project/node_modules/google-auth-library/lib/transporters.js:85:15)
at Request.init.self.callback (/path/to/project/node_modules/request/request.js:186:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.readResponseBody (/path/to/project/node_modules/request/request.js:1081:10)
at Request.EventEmitter.emit (events.js:95:17)
at IncomingMessage.Request.onRequestResponse (/path/to/project/node_modules/request/request.js:1001:12)
at IncomingMessage.g (events.js:180:16)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
And error object looks like:
{
"cause": {
"code": 400,
"errors": [
{
"message": "Invalid requests[224].updatePageProperties: There was a problem retrieving the specified image.",
"domain": "global",
"reason": "badRequest"
}
]
},
"isOperational": true,
"code": 400,
"errors": [
{
"message": "Invalid requests[224].updatePageProperties: There was a problem retrieving the specified image.",
"domain": "global",
"reason": "badRequest"
}
]
}

How do I update a non-unique property in Freebase?

I've been working on a calorie counter and I'm slowly making progress on my MQL write. The issue that I'm having currently is updating the recipe itself which is in the /common/topic/description property.
The query that I am using currently is:
[{
id: recipeId, // previously retrieved
'/common/topic/description': {
connect: 'replace',
value: $('#description textarea').val(),
lang: '/lang/en'
}
}]
This succeeds in executing, but when I query (another) after it has run I get an error:
{
"domain": "global",
"reason": "invalid",
"message": "Unique query may have at most one result. Got 2",
"locationType": "other",
"location": "/common/topic/description"
}
According to the documentation, connect: replace does an update on unique properties and an insert on non-unique ones. So am I getting that because a value was inserted?
Is it necessary to remove the other value to prevent the error? Do I need to know the existing value in order to remove it?
{
id: recipeId,
'/common/topic/description': {
connect: 'delete',
value: 'Value currently stored',
lang: '/lang/en'
}
}
The problem doesn't anything to do with updating non-unique properties. Your read query is the issue. You didn't quote the failing query, but the part of the error message that says "location": "/common/topic/description" is your hint. That topic has two descriptions, one empty and one not, but you haven't used array notation in you query.
This will work:
[{
"id": "/m/0wh83sg",
"/food/recipe/ingredients": [{
"id": null,
"ingredient": {
"id": null,
"name": null,
"/food/food/energy": null,
"/common/topic/image": {
"id": null,
"optional": true,
"limit": 1
},
"optional": true
},
"unit": {
"id": null,
"name": null,
"optional": true
},
"quantity": null,
"notes": null
}],
"/common/topic/description": [{}]
}]

Resources