Web Services - api/service/mqlread

Service Details

Service path https://api.freebase.com/api/service/mqlread
Permits HTTP GET true
Permits HTTP POST true
Requires authentication false
Extra arguments ignored true
Response format application/json

Arguments

Name Type Default Value Format
queries Required JSON
query Required JSON

Notes

The mqlread service is used to perform read-only queries on Freebase data.

MQL queries must be wrapped in an envelope consisting of two JSON objects before being sent to mqlread. This is explained in detail in section 4.2.4 of the The MQL Reference Guide.

If you are writing Acre scripts, then you should use the convenient function acre.freebase.mqlread instead of issuing HTTP requests to this web service.

Envelope Parameters

cursor true
enables the retrieval of a large result set in batches
escape false
Disables escaping of , & characters. Should not be used to display output in web browsers since it opens vulnerability to script injection attacks.
lang lang/language_id
specify the language in which you want the results returned
as_of_time timestamp
specify that the results should reflect the state of the database as of the time specified by the timestamp (useful for making historical queries)
uniqueness_failure hard, soft
Prevents an error when more than one result is returned and the query is not enclosed in square brackets indicating that multiple results are expected.

Full information on mqlread can be found in Chapter 4 of the MQL Reference Guide.

Examples

A single query:
https://api.freebase.com/api/service/mqlread?query={"query":[{"id":"/topic/en/edinburgh","key":[{"namespace":"/wikipedia/en_id","value":null}]}]}

Multiple queries in a single request:
https://api.freebase.com/api/service/mqlread?queries={"q0":{"query":[{"id":"/topic/en/edinburgh","key":[{"namespace":"/wikipedia/en_id","value":null}]}]},"q1":{"query":[{"id":"/topic/en/hamster","key":[{"namespace":"/wikipedia/en_id","value":null}]}]}}

For additional information on using the callback parameter to generate a JSONP response, or using onsucceed and onfail to redirect to a URI template, see Common API Headers and Parameters.