How to pass Vertex id as a parameter via POST

Having a bit of trouble figuring out how to pass a Vertex parameter via HTTP POST.

Here’s the function signature:

CREATE QUERY delete_strategy_instance(VERTEX<IbisInstance> instance) syntax v2 {

I’m doing a POST with {"instance": "test_delete_a1"}
And I’ve also tried {"instance": {"type":"IbisInstance","instance_name":"test_delete_a1"}}
And I’ve also tried {"instance": {"type":"IbisInstance","id":"test_delete_a1"}}

Using GET works, but I want to make sure I know how to get this working with POST for future.
Any advice?

If the REST++ server is local, then server_ip is localhost.

The request can use either the GET or POST method. The query parameter values are either included directly in the query string of the HTTP request’s URL or supplied using a data payload. The basic format for the parameters as a query string is
param1=value&param2=value&param3=value

If you use data payload, JSON format only support GET. We are developing JSON format to support POST in the next minor release version.

What about the example right here: https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-shortestpath-graphname-shortest-path-search

Looks like it’s using POST data payload to specify vertices:

curl -s -X POST 'http://localhost:9000/shortestpath' -d
'{
  "sources":[{"type":"VidUser","id":"2"}],
  "targets":[{"type":"VidUser","id":"0"}, {"type":"VidUser","id":"3"}],
  "edgeFilters":[{"type":"User_Video","condition":"rating > 5 and date_time > 1000}],
  "maxLength":4
}'

Also looks like there’s a missing quote in that example.

the doc of shortestpath is a built-in query. It’s not written by GSQL. If you use GSQL install query to generate the endpoint, we do not support passing parameter by json using POST yet. It’s coming though.

1 Like