How to call REST api?

Suppose I have a database called db on localhost and I have a sparql query to run. How to run the REST api so I can get the returned result in either JSON or TXT format? Thanks!

Hi,

You will simply need to send your query to http://localhost:5820/myDb/query?query=<URL-encoded-query>

For JSON results just add an “Accept: application/sparql-results+json” header.

Stephen:

Thanks for the quick reply. But I am not sure how to add the Accept: application/sparql-results+json” header to the http call. Can you please give me an example?

Thanks!

Rui

What are you using to make the call?

I am using a web browser

You'll need to use a plugin that allows you to set the headers. Something like this for Firefox

There should be something equivalent for other browsers.

I love Postman which runs as a separate (free) application (on Windows, Mac or Linux) and works really well with the Stardog REST API. https://www.getpostman.com/

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.