21.7.1 Run an Asynchronous PGQL Query

POST https://localhost:7007/v2/runQueryAsync

Run a PGQL query asynchronously on a property graph.

Version: v2

Request

Request Header

  • Accept: application/json; charset=UTF-8
  • Header: Authorization: Bearer <token>
  • Content-Type: application/json

Request Query Parameters: See Table 21-3 for details.

Sample Request Body

{
  "statements": [
    "CREATE PROPERTY GRAPH test_graph VERTEX TABLES (regions KEY (region_id), countries KEY (country_id))EDGE TABLES (countries AS countries_regions SOURCE KEY ( country_id ) REFERENCES 
     countries(country_id) DESTINATION KEY (region_id) REFERENCES regions(region_id) NO PROPERTIES ) OPTIONS (pg_pgql)", 
    "SELECT v FROM MATCH (v) ON test_graph LIMIT 1"
  ],
  "driver": "PGQL_IN_DATABASE",
  "parameters": {
    "dynamicSampling": 2,
    "parallel": 8,
    "start": 0,
    "size": 100
  },
  "visualize": true

Response

  • 202 OK
  • Content-Type: application/json

Sample Response Body

{
    "message": "Query execution started.",
    "result_id": 0
}

cURL Example

curl --location --request POST 'https://localhost:7007/v2/runQueryAsync' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "statements": [
    "CREATE PROPERTY GRAPH test_graph VERTEX TABLES (regions KEY (region_id), countries KEY (country_id))EDGE TABLES (countries AS countries_regions SOURCE KEY ( country_id ) REFERENCES 
     countries(country_id) DESTINATION KEY (region_id) REFERENCES regions(region_id) NO PROPERTIES ) OPTIONS ( pg_pgql)",
    "SELECT v FROM MATCH (v) ON test_graph LIMIT 1"
  ],
  "driver": "PGQL_IN_DATABASE",
  "parameters": {
    "dynamicSampling": 2,
    "parallel": 8,
    "start": 0,
    "size": 100  
  },
  "visualize": true
}'