# View data privilege operation

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

View the processing progress and per-resource results for a data-privilege change. A successful request only reads the current state; it does not mean the grant is complete.

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/iam/roles/{role_id}/data-privilege-operations/{request_id}
```

## Preparation before calling

First [select a role](../roles/list-roles.md#select-a-role). Then keep the change identifier returned by [applying data privileges](apply-data-privileges.md#continue-tracking-the-change) or by a repair operation.

Prepare a [personal access token](../../../../../guides/genesis/api-keys.md) with the required permissions for the target workspace and the [target workspace ID](../../../../../guides/ai-studio/resource-center/workspace.md#copy-a-workspace-id).

### Select the change to track

Use the identifier returned by [applying data privileges](apply-data-privileges.md#continue-tracking-the-change) or a repair operation to view the current result of that same grant change.

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Input example

```bash
curl -X GET "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/iam/roles/$ROLE_ID/data-privilege-operations/$REQUEST_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameter description

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | Target workspace ID. |
| `role_id` | string | Yes | Target role ID. |
| `request_id` | string | Yes | Original request ID submitted when applying data privileges. |

:::::
::::::
:::::::

## Successful response

Returns the operation state and per-resource results for the original request. Keep viewing when the state is `applying`; the operation is complete at `succeeded`. For `failed`, `drifted`, or `unknown`, review the resource results and decide whether to repair it.

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{"code":"OK","msg":"OK","data":{"request_id":"req-001","trace_id":"trace-001","operation_id":"operation-001","audit_event_id":"audit-001","state":"succeeded","data_privilege_version":2,"idempotent_replay":false,"session_invalidation_status":"new_connections_only","matrixone_fact_version":"fact-v2","resource_results":[]}}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.request_id` | string | Original data-privilege request ID. |
| `data.operation_id` | string | Server-generated operation ID. |
| `data.audit_event_id` | string | Audit event ID. |
| `data.state` | string | Operation state: `applying`, `succeeded`, `failed`, `drifted`, or `unknown`. |
| `data.data_privilege_version` | integer | Current data-privilege version. |
| `data.session_invalidation_status` | string | Session privilege refresh status. |
| `data.matrixone_fact_version` | string | MatrixOne privilege fact version. |
| `data.resource_results` | object array | Privilege execution result for each resource. |
| `data.trace_id` | string | Trace ID. |

:::::
::::::
:::::::

## Error response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{"code":"ErrParamInvalid","msg":"Invalid request parameters","data":null}
```

:::::
:::::{tab-item} Field details

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | Error code. |
| `msg` | string | Error message. |
| `data` | null | — |

:::::
::::::
:::::::

## Next steps

### Determine whether repair is applicable

Only [repair a data privilege operation](repair-data-privilege-operation.md) when its result shows that repair is needed or cannot be confirmed. Continue viewing while processing has not ended; a succeeded or clearly failed change is not eligible for repair.
