Skip to content

Request configuration ​

requestConfig controls how queries are sent to the endpoint. It is accepted by both SparqlEditor and SparqlStudio (where it sets the default for every tab).

Every field may be a value or a (sparqlEditor) => value function, so you can compute it per request.

ts
new SparqlStudio(el, {
  requestConfig: {
    endpoint: "https://sparql.dblp.org/sparql",
    method: "POST",
    headers: () => ({ Authorization: `Bearer ${getToken()}` }),
    withCredentials: false,
  },
});
fielddefaultdescription
endpoint—SPARQL endpoint URL
method"POST""GET" or "POST"
acceptHeaderSelectapplication/sparql-results+json,*/*;q=0.9accept header for SELECT / ASK
acceptHeaderGraphapplication/n-triples,*/*;q=0.9accept header for CONSTRUCT / DESCRIBE
acceptHeaderUpdatetext/plain,*/*;q=0.9accept header for updates
namedGraphs / defaultGraphs[]graph URIs
args[]extra { name, value } request args
headers{}extra HTTP headers
withCredentialsfalsesend credentials (cookies) with the request
adjustQueryBeforeRequestfalse(sparqlEditor) => string to rewrite the query before sending

CORS

If the endpoint does not return CORS headers, set a corsProxy on SparqlStudio rather than fighting the request config. See SparqlStudio · CORS.