Closed rajaram5 closed 2 years ago
Hi @rajaram5,
Yes it is possible! grlc already supports this functionality.
See https://github.com/CLARIAH/grlc#method for reference, but basically you need to include the #+ method: POST
decorator, and then you can call your query via post like this:
curl -X POST "http://grlc.io/api-git/CLARIAH/grlc-queries/method?endpoint=https%3A%2F%2Fdbpedia.org%2Fsparql" -H "accept: text/csv"
Hope this helps?
Yes, I understood method config but I want to pass request body
as part of my API and use values from the request body
in the SPARQL query. Is this possible with glrc?
Do you mean something like:
curl -X POST "http://grlc.io/api-git/CLARIAH/grlc-queries/method" -H "accept: text/csv" -d "endpoint=https://Fdbpedia.org/sparql"
that would work.
No something like example below. I am want to pass data in my request body
. In this case I am passing gender uri. I also want to use this gender uri in the SPARQL query
curl -X POST https://example.com/beacon2/api/individuals -d '{"gender": "http://purl.obolibrary.org/obo/NCIT_C20197"}'
I think that should work. I just tried:
curl -X POST "http://grlc.io/api-git/CLARIAH/grlc-queries/method" -d '{ "endpoint": "https://dbpedia.org/sparql" }'
and it worked.
Do let me know if it does not work for your use case
Ok let me give it a try
Hi @c-martinez I wonder if grlc server supports POST methods with request body. I also like to extract the values from the POST body and use it in the query. Does grlc support this functionality?