Skip to content

Request configuration

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

Every field may be a value or a (yasqe) => 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
endpointSPARQL 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(yasqe) => 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.