SELECT and DESCRIBE with SPARQL query using POST request

Hi community,

I have an API call that works fine using the GET method (thanks to the answer here):

https://[usr].stardog.cloud:5820/[DB]/query?query=SELECT%20*WHERE%20%7B%20%20%20%20%3Fs%20%3Fp%20%3Fo%20.%7DLIMIT%201000&default-graph-uri=tag:stardog:designer:[myOntology]:model

to avoid having the query in the URL, especially if they get longer, I would like to do the same with a POST request, sending the query in the body.

The first issue I ran into is that POST seems to need write access to the actual DB resource even when I am planning to only run SELECT and DESCRIBE queries (otherwise it gives me "User does not have write permissions for the index."), while GET works fine with read access only.

Secondly, I am a bit lost as to how to get the query in the payload of the request.
Simply typing it in the body seems not the way to go - at least in Postman it gives me an error:

although to me, it looks like it's done the same here.

Or is POST the wrong method in the first place to achieve this?

Thank you!

1 Like

With a hint from a colleague and some trying, the query now runs successful when using the Postman setting "X-WWW-form-urlencoded"

It even works with only read access granted to the API user.

1 Like