Query Status API

After you run queries in Detached Mode via the RESTPP endpoint with the GSQL-ASYNC header set to true, you can use the Query Status API to obtain the status and results of the related request_id. This is similar to what you can retrieve from the RESTPP Query Status API , along with the GPE logs.

GET /api/queries/<graphName>/query_status?requestid=<requestid>

Authentication

This endpoint requires GUI authentication. You can use it in a browser after logging into Graph Studio, as the browser will automatically handle the cookie for identity verification.

Sample Request:

  • Request

  • Response

curl -X GET "http://localhost:14240/api/queries/MyGraph/query_status?requestid=17.RESTPP_1_1.1719383758395.N"
{
  "error": false,
  "message": "",
  "results": [
    {
      "requestid": "17.RESTPP_1_1.1719383758395.N", (1)
      "startTime": "2024-06-26 06:35:58.395", (2)
      "expirationTime": "2024-06-26 06:36:14.395", (3)
      "url": "/query/MyGraph/all_connection", (4)
      "elapsedTime": 7, (5)
      "status": "success", (6)
      "results": [
        {
          "@@edgeList": [
            {
              "attributes": {},
              "directed": true,
              "e_type": "INFECTED_BY",
              "from_id": "4100000006",
              "from_type": "Patient",
              "to_id": "4100000007",
              "to_type": "Patient"
            },
            {
              "attributes": {},
              "directed": true,
              "e_type": "reverse_INFECTED_BY",
              "from_id": "4100000006",
              "from_type": "Patient",
              "to_id": "4100000041",
              "to_type": "Patient"
            }
          ]
        }
      ],
      "processLogs": {
        "m1": [
          {
            "line": "I0626 06:35:58.396185 14134 servicebase.hpp:205] Request|MyGraph::default,17.RESTPP_1_1.1719383758395.N,YNN,16,0,0,0,S,|Received", (7)
            "path": "/home/tigergraph/tigergraph/log/gpe/INFO.20240626-023538.12880", (8)
            "offset": 2539791, (9)
            "lineNumber": 17086 (10)
          },
          {
            "line": "I0626 06:35:58.396270 13600 engineservicerequest.hpp:321] Request|MyGraph::default,17.RESTPP_1_1.1719383758395.N,YNN,16,0,0,0,S,|HoldQueryState to block rebuild initialization.",
            "path": "/home/tigergraph/tigergraph/log/gpe/INFO.20240626-023538.12880",
            "offset": 2539929,
            "lineNumber": 17087
          }
        ]
      }
    }
  ]
}

Parameters

Name

Required

Description

requestid

Yes

The ID of the query from the response of the RESTPP endpoint request to run the Detached Query

graphName

Yes

The name of the graph related to the query

Response Fields

Field

Description

requestid

The query ID associated with the given query status JSON object.

startTime

The timestamp for the start time of the given query.

expirationTime

The timestamp for when the given query times out.

url

The URL of the given query.

elapsedTime

The elapsed real time of the given query measured in milliseconds. For completed queries, the value shows the total runtime of the request. For ongoing queries, it shows the amount of time taken so far.

status

The status of the given query. Possible values are “success”, “timeout”, “aborted”, or “running”.

results

The results of the query, including any relevant data such as edge lists.

processLogs

The log content related to the query.

path

The log file path of the log content.

offset

The offset in bytes of the log content in the log file.

lineNumber

The line number of the log content in the log file.