How to run parameterized SQL from RestAPI
OrientDB Version: How to check
Java Version: Not Sure
OS: Not sure
I need to query the OrientDB using Rest API
I can run normal SQL like this
http://ip:port/command/
But I would like to run command like this
http://ip:port/command/
Hi @BalaTrigyn
Please check this https://orientdb.org/docs/3.1.x/misc/OrientDB-REST.html#post---command you'll find exactly what you need
Thanks
Luigi
Hi luigidellaquila,
It fails with error "content": "Error parsing query:\u000a{ "command": "select count(*) from V where code = :name", "parameters":
Here is the query I tried to run
http://ip:port/command/dbname/sql/{ "command": "select count(*) from country where code = :name", "parameters": { "name": CHN" } }
It would be great if you can provide me a working example, I feel I am messing up in the syntax
Hi @luigidellaquila
I think the problem here is that you are appending the request content to the URL.
You should send it as the POST data instead (eg. -d with CURL)
Thanks
Luigi
Cannot use CURL ,since PowerBI does not support it , any other way you know of?
Hi @BalaTrigyn
I don't know PowerBI, but I think it supports sending POST requests with data. Checking Google for the topic I found this, maybe it will help https://community.powerbi.com/t5/Power-Query/Getting-data-from-API-with-JSON-body/m-p/1047261#M35290
thanks
Luigi
I'd add here that I'd like to see a "query POST variant" being basically the same as the command variant, but limited to queries / "idempotent commands".