

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Gremlin 查詢取消
<a name="gremlin-api-status-cancel"></a>

若要取得 Gremlin 查詢的狀態，請使用 HTTP `GET` 或 `POST` 向 `https://{{your-neptune-endpoint}}:{{port}}/gremlin/status` 端點提出請求。

## Gremlin 查詢取消請求參數
<a name="gremlin-api-status-cancel-request"></a>
+ **cancelQuery** – 取消的必要項目。參數沒有對應的值。
+ **queryId** – 要取消之執行中 Gremlin 查詢的 ID。

## Gremlin 查詢取消範例
<a name="gremlin-api-status-cancel-example"></a>

以下是取消查詢的範例。

------
#### [ AWS CLI ]

```
aws neptunedata cancel-gremlin-query \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --query-id "fb34cd3e-f37c-4d12-9cf2-03bb741bf54f"
```

如需詳細資訊，請參閱《 AWS CLI 命令參考》中的 [cancel-gremlin-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/cancel-gremlin-query.html)。

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.cancel_gremlin_query(
    queryId='fb34cd3e-f37c-4d12-9cf2-03bb741bf54f'
)

print(response)
```

如需 Java、.NET 等其他語言的 AWS SDK 範例，請參閱 [AWS 開發套件](access-graph-gremlin-sdk.md)。

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/gremlin/status \
  --region {{us-east-1}} \
  --service neptune-db \
  --data-urlencode "cancelQuery" \
  --data-urlencode "queryId=fb34cd3e-f37c-4d12-9cf2-03bb741bf54f"
```

**注意**  
此範例假設您的 AWS 登入資料已在您的環境中設定。將 {{us-east-1}} 取代為 Neptune 叢集的 區域。

如需使用 **awscurl**搭配 IAM 身分驗證的詳細資訊，請參閱 [使用 `awscurl` 搭配臨時憑證，安全地連線至啟用 IAM 身分驗證的資料庫叢集](iam-auth-connect-command-line.md#iam-auth-connect-awscurl)。

------
#### [ curl ]

```
curl https://{{your-neptune-endpoint}}:{{port}}/gremlin/status \
  --data-urlencode "cancelQuery" \
  --data-urlencode "queryId=fb34cd3e-f37c-4d12-9cf2-03bb741bf54f"
```

------

成功取消會傳回 HTTP `200` OK。