Edit

Share via


Items - Execute Query (preview)

Executes a query on the specified graph model.

Note

GraphModel item is currently in Preview (learn more). This API is part of a Beta release and is provided for evaluation and development purposes only. It may change based on feedback and is not recommended for production use. When calling this API, callers must specify true as the value for the query parameter beta (preview query parameter has been replaced by beta. For backward compatibility, preview is still supported and behaves the same as beta).

This API supports pagination.

Permissions

The caller must have a viewer workspace role.

Required Delegated Scopes

Workspace.Read.All or Workspace.ReadWrite.All

Microsoft Entra supported identities

This API supports the Microsoft identities listed in this section.

Identity Support
User Yes
Service principal and Managed identities No

Interface

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/GraphModels/{GraphModelId}/executeQuery?beta={beta}

URI Parameters

Name In Required Type Description
GraphModelId
path True

string (uuid)

The GraphModel ID.

workspaceId
path True

string (uuid)

The workspace ID.

beta
query True

boolean

This required parameter must be set to true to access this API, which is currently in beta.

Request Body

Name Required Type Description
query True

string

The query string.

Responses

Name Type Description
200 OK

file

Query execution completed successfully. Results are in JSON format. Refer to the MSFT GQL API on how to read the data.

Other Status Codes

ErrorResponse

Common error codes:

  • OperationNotSupportedForItem - Operation not supported for requested item.

  • CorruptedPayload - The provided payload is corrupted.

Examples

Execute a graph query example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/cfafbeb1-8037-4d0c-896e-a46fb27ff229/GraphModels/5b218778-e7a5-4d73-8187-f10824047715/executeQuery?beta=True

{
  "query": "MATCH (node_station:`station`) RETURN TO_JSON_STRING(node_station) AS `station` LIMIT 10;"
}

Sample response

{
  "status": {
    "code": "00000",
    "description": "note: successful completion",
    "diagnostics": {
      "OPERATION": "query",
      "OPERATION_CODE": "0",
      "CURRENT_SCHEMA": "/"
    }
  },
  "result": {
    "kind": "TABLE",
    "columns": [
      {
        "name": "station",
        "gqlType": "STRING",
        "jsonType": "string"
      }
    ],
    "data": [
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263937\",\"properties\":{\"stationFrom\":\"Holborn\",\"stationTo\":\"Chancery_Lane\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263938\",\"properties\":{\"stationFrom\":\"Chancery_Lane\",\"stationTo\":\"St_Paul's\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263939\",\"properties\":{\"stationFrom\":\"Hyde_Park_Corner\",\"stationTo\":\"Green_Park\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263940\",\"properties\":{\"stationFrom\":\"Holborn\",\"stationTo\":\"Russel_Square\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263941\",\"properties\":{\"stationFrom\":\"Euston\",\"stationTo\":\"Warren_Street\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263942\",\"properties\":{\"stationFrom\":\"Victoria\",\"stationTo\":\"Pimlico\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263943\",\"properties\":{\"stationFrom\":\"London_Bridge\",\"stationTo\":\"Monument\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263944\",\"properties\":{\"stationFrom\":\"Moorgate\",\"stationTo\":\"Old_Street\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263945\",\"properties\":{\"stationFrom\":\"South_Kensington\",\"stationTo\":\"Sloane_Square\"}}"
      },
      {
        "station": "{\"labels\":[\"station\"],\"oid\":\"1688849860263946\",\"properties\":{\"stationFrom\":\"Victoria\",\"stationTo\":\"St_James's_Park\"}}"
      }
    ]
  }
}

Definitions

Name Description
ErrorRelatedResource

The error related resource details object.

ErrorResponse

The error response.

ErrorResponseDetails

The error response details.

ExecuteQueryRequest

Execute query request payload.

ErrorRelatedResource

The error related resource details object.

Name Type Description
resourceId

string

The resource ID that's involved in the error.

resourceType

string

The type of the resource that's involved in the error.

ErrorResponse

The error response.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

moreDetails

ErrorResponseDetails[]

List of additional error details.

relatedResource

ErrorRelatedResource

The error related resource details.

requestId

string

ID of the request associated with the error.

ErrorResponseDetails

The error response details.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

relatedResource

ErrorRelatedResource

The error related resource details.

ExecuteQueryRequest

Execute query request payload.

Name Type Description
query

string

The query string.