Authentication
⚠️ Warning: Authentication should only be used with TLS/HTTPS, otherwise the credentials will be sent in plain text. The following examples will still use HTTP for demonstration purposes only.
Cookies
Login on the Terminal
curl can be used to log in via the terminal.
curl -c "/tmp/my-cookie" \
--data "username=YOUR_USERNAME&password=YOUR_PASSWORD" http://localhost:9080/login
After logging in, you need to send the cookie you received to the server every time you want to issue a query (with
-b).
curl -b "/tmp/my-cookie" -H "Content-Type: application/sparql-query" \
--data "SELECT (COUNT(*) AS ?c) WHERE { ?s ?p ?o }" http://localhost:9080/sparql
Basic Authentication
Passing Credentials Separately
curl takes the credentials with the -u option, in the form username:password.
curl -u "alice:secret" -H "Content-Type: application/sparql-query" \
--data "SELECT (COUNT(*) AS ?c) WHERE { ?s ?p ?o }" http://localhost:9080/sparql
Passing Credentials in the URL
curl can also process credentials directly from the URL, in the form http://username:password@host:port/path.
curl -H "Content-Type: application/sparql-query" \
--data "SELECT (COUNT(*) AS ?c) WHERE { ?s ?p ?o }" http://alice:secret@localhost:9080/sparql
Bearer Tokens
Only the MCP endpoint accepts bearer tokens. To make a token, refer to Tokens.