Wikipedia

Get Wikidata SPARQL query result

Get a read-only Wikidata SPARQL query result as bindings or an ASK answer.

GET/v1/wikipedia/wikidata/query
1credit
x-api-keystringheader

API key (`sfk_...`)

Parameters
2
sparqlstringrequiredquery

Read-only SPARQL query. `INSERT`, `DELETE`, `LOAD`, `CLEAR`, `DROP`, `CREATE`, `ADD`, `MOVE`, `COPY` and `WITH` are refused.

min 1 chars · max 10000 chars

formatstringoptionalquery

Result format. Only `json` is served.

one of: json

Response fields
14

Endpoint-specific response payload.

datalookupStatus
string

Whether the entity, page or data set exists. A missing entity is `not_found`; an existing entity with no rows is `found` with `empty: true`.

one of: found, not_found

SPARQL result head.

Variable names.

dataheadvars[]
stringoptional
databoolean
booleannullable

ASK answer; null for SELECT and CONSTRUCT-shaped results.

Rows, one object per result.

databindings[]
objectoptional
datarowCount
integer

Number of rows.

≥ 0

dataempty
boolean

Whether the answer is a valid empty result rather than missing.

Metadata describing the request and billing outcome.

metarequestId
string

Unique request identifier for tracing this API call.

min 1 chars

metacreditsCharged
integer

Credits charged for this request.

≥ 0

metaversion
string

Public API version that served the response.

one of: v1

Code example

curl "https://api.socialfetch.dev/v1/wikipedia/wikidata/query?sparql=SELECT%20?item%20WHERE%20{%20?item%20wdt:P31%20wd:Q146%20}%20LIMIT%203" \
  -H "x-api-key: YOUR_API_KEY"

Responses

Get Wikidata SPARQL query result