Non unique query with Freebase MQL read google api - google-api

It seems I am only able to do unique queries (i.e. including an entity id in the query) with the new freebase MQL read api:
The following searches on id and type:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"id":"/en/bob_dylan","type":"/people/person"}
and successfully returns:
{
"result": {
"type": "/people/person",
"id": "/en/bob_dylan",
"name": "Bob Dylan"
}
}
The following searches with type only:
https://www.googleapis.com/freebase/v1/mqlread?query={"name":null,"type":"/people/person"}
or
https://www.googleapis.com/freebase/v1/mqlread?query={"name":[],"type":"/people/person"}
and returns the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Unique query may have at most one result. Got 100"
}
],
"code": 400,
"message": "Unique query may have at most one result. Got 100"
}
}
I expected it to return a list of people's names

You have to wrap your query in [ ], as in the following example:
https://www.googleapis.com/freebase/v1/mqlread?query=[{"name":[],"type":"/people/person"}]

I too faced a similar problem recently. The best way to make sure you get a single result set is to use "limit:1" parameter in your mql query.
for example:
https://www.googleapis.com/freebase/v1/mqlread?query={"type":[],"name":"india","limit":1}

Related

Directus - Retrieve relations with GraphQL

I try to retrieve the relations of the database of my directus app.
I use GraphQL with following endpoint https://myapp.directus.app/graphql.
Using a query for the relations according to the docs
query {
relations {
collection
field
}
}
leads to an validation error:
{
"errors": [
{
"message": "GraphQL validation error.",
"extensions": {
"code": "GRAPHQL_VALIDATION_EXCEPTION",
"graphqlErrors": [
{
"message": "Cannot query field "relations" on type "Query". Did you mean "locations"?",
"locations": [
{
"line": 2,
"column": 2
}
]
}
]
}
}
]
}
I use Postman so far and started with a query for the database entries
query {
boards {
id
columns {
id
name
}
}
}
which works as expected.
What I find interesting is, that Postman shows an mouseover text on the keyword "relations" of the 2nd query -->
"Cannot query field relations on type Query. Did you mean locations?"
But unfortunately I have no idea what to do with that message.
Any ideas what is wrong here?
Meanwhile I found the problem. The endpoint for queries on relations is https://myapp.directus.app/graphql/system
With that the query
query {
relations {
collection
field
}
}
is working

Is there a way to get a count of the number of patients (or other resources) from a FHIR server?

Is it possible to get a count for the number of Patients on an FHIR server. Searching for FHIR and count I get several results for using _count to limit the number of records returned by a query, but I'm not seeing anything that shows how to get a count for the number of Patients on a FHIR Patient server.
It looks like this is being done with the _summary=count parameter:
https://syntheticmass.mitre.org/v1/fhir/Patient?_summary=count&apikey=API_KEY_GOES_HERE
Unfortunately it looks like this isn't supported by syntheicmass
{
"issue": [
{
"code": "value",
"details": {
"text": "invalid_query"
},
"diagnostics": "generic::unimplemented: _summary argument is not supported yet.",
"severity": "error"
}
],
"resourceType": "OperationOutcome"
}
You could use _total
https://syntheticmass.mitre.org/v1/fhir/Patient?apikey=<your key here>&_total=accurate
Which should return something along these lines (see example below). You can access the total # of Patients resources via the total element in the returned Bundle
{
"entry":[
...
],
"link":[
...
],
"resourceType":"Bundle",
"total":500,
"type":"searchset"
}
Read more about this option from the fhir wiki

Microsoft graph API - unable to use $filter operation in "toRecipients" array

Hello guys hope ur doing good,
I want to filter out the graph api response based on the "toRecipient" which is a array, hence I used lambda expression, but it gives error.
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"date": "2021-09-22T06:04:17",
"request-id": "c6077cd4-dbec-4671-9c11-10e547917d29",
"client-request-id": "66dfbc92-2482-11f3-86f9-22652a4e4e00"
}
}
My actual response is
"toRecipients": [
{
"emailAddress": {
"name": "abc",
"address": "abc#abc.com"
}
}
],
I had used this operation to filter out
https://graph.microsoft.com/v1.0/me/mailFolders/sentItems/messages?&$top=1000&$search="abc#abc.com"
Graph API calls underlaying Office 365 API.
According to the documentation, property ToRecipients is not filterable.

How to ignore highlighted fields in a kibana query?

I'm trying to make a query in kibana that shows all the errors in a service, but the results only shows the data with the field "highlight", how can I ignore it?
I've tried making a DSL query like this:
{
"query": {
"exists": {
"field": "payload.error"
}
}
}
but it does not work as I expect
This is the structure of the data that is show in the query answer:
"payload": {
"method": "standardError",
"error": {
"code": "300",
"detail": "{\"Cliente no posee fecha\"}",
"message": "BUS_ERROR"
}
},
"highlight": {
"payload.error.code.keyword": [
"#kibana-highlighted-field#107#/kibana-highlighted-field#"
]
}
The data that is not show in the query result does not have the field "highlight" but have the exact same payload structure
I expect a query that shows all the data with the field payload.error, no matter if it has a highlight field or not
Not sure what you are looking for, but can't you just use the Search Box on the top and write something like:
payload.error:* AND highlight.payload.error.code.keyword:
That will give you all the hits that fulfill them both. Or:
payload.error:*
That will give you all the hits where "payload.error" is used.
As I read your example, then highlight doesn't really have anything to do with the first payload, you have above and therefore searching only for "payload.error:*" should be enough?

API Discovery Service return error only in BigQuery

API Discovery Service of BigQuery had worked well, but recently it suddenly returns error.
NG https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest?fields=kind
OK https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest
OK https://www.googleapis.com/discovery/v1/apis/discovery/v1/rest?fields=kind
Google's API Discovery Service has fields parameter.
It works well in some api such as discovery (case 3), but doesn't work in bigquery (case 1).
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "kind",
"description": "Error expanding 'fields' parameter. Cannot find matching fields for path 'kind'."
}
]
}
]
}
}
It works well if fields is deleted (case 2).
google-api-javascript-client has same issue.
I think this is bug of google, or is there any mistake?
This was indeed a Google issue and is now fixed.

Resources