Check a plugin account authorization attempt¶
Check and advance an authorization attempt for the same plugin account.
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/plugin-connections/{connection_id}/oauth/{attempt_id}/poll
Before you call this API¶
Prepare the target workspace ID and a personal access token with resource access and permission for this action. Use actual resource identifiers for path workspace_id, connection_id, and attempt_id. Set X-Workspace-ID to the workspace ID. The example uses jq to construct JSON; install it first. See common objects and inputs for environment variable sources.
Request body¶
curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/plugin-connections/$CONNECTION_ID/oauth/$ATTEMPT_ID/poll" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
--data-binary "$(jq -n --argjson CONNECTION_VERSION "$CONNECTION_VERSION" '
{
"expected_version": $CONNECTION_VERSION
}
')"
Set $ATTEMPT_ID to the saved nonempty attempt ID. Each call performs one check. Obey poll_after while pending/exchanging and stop at a terminal state. Authorization status determines whether authorization is usable. next_action requires another user action. Recheck when versions change or attempts become superseded or expired; do not automatically start new authorization.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Current connection or installation version; must be greater than 0. |
JSON objects reject unknown fields, duplicate keys, and multiple consecutive objects. The entire request body must not exceed 1 MiB.
Successful response¶
{
"code": 0,
"data": {
"attempt_id": "attempt_example",
"status": "pending",
"poll_after": 2
}
}
Field |
Type |
Description |
|---|---|---|
|
integer |
0 on success. |
|
object |
Data returned by this action. |
|
string |
Authorization attempt ID; empty for browser_handoff. |
|
string |
Current state; assess it using this page’s conditions and common objects. |
|
integer |
Resource fields; see common objects and states. |
Error responses¶
Handle business errors with numeric code, message, and details.reason separately from authorization-layer errors with string codes. See errors and states. On state or version conflicts, read the current resource before changing identifiers or retrying writes.