找出有相關行為的帳戶

本文將說明如何找出有相關行為的帳戶。舉例來說,您可能想找出惡意使用者建立的所有使用者帳戶。您可以找出有相關行為的帳戶、帳戶群組和帳戶群組成員。

找出有相關行為的帳戶,有助於您在先前合法的帳戶與有濫用行為的帳戶相關時,找出虛假帳戶群組和帳戶盜用情形。

這項功能僅適用於 reCAPTCHA REST API 和用戶端程式庫。

如要擷取與指定帳戶相關的帳戶清單,請使用 relatedaccountgroupmemberships.search 方法。

使用任何要求資料之前,請先替換以下項目:

  • PROJECT_ID:您的 Google Cloud 專案 ID。
  • ACCOUNT_ID:與使用者帳戶專屬關聯的 ID,可將使用者帳戶連結至網站。
  • PAGE_SIZE:選用。要在回應中納入的帳戶成員人數。 預設值為 50,最大值為 1,000。如果帳戶成員人數超過頁面大小,回應會包含分頁符記,可用於擷取下一頁結果。
  • NEXT_PAGE_TOKEN:選用。這個方法先前回應中傳回的 nextPageToken 值。指定這個參數,即可查詢更多帳戶成員。

HTTP 方法和網址:

POST https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

JSON 要求主體:

{
  "accountId": "ACCOUNT_ID"
}

如要傳送要求,請選擇以下其中一個選項:

curl

將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

將要求主體儲存在名為 request.json 的檔案中,然後執行下列指令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroupmemberships:search?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您應該會收到如下的 JSON 回應:

{
  "relatedAccountGroupMemberships": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId187/memberships/membershipId95",
      "accountId": "4RopXS59"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId91/memberships/membershipId23",
      "accountId": "HVMv1DTb"
    }
  ],

  "nextPageToken": "Q2N_rZgxUXOjNZtK1T1i0Q"
}

程式碼範例

擷取相關帳戶群組

如要擷取行為相似的帳戶群組清單,請使用 relatedaccountgroups.list 方法。

使用任何要求資料之前,請先替換以下項目:

  • PROJECT_ID:您的 Google Cloud 專案 ID。
  • PAGE_SIZE:選用。要在回應中納入的帳戶群組數量。 預設值為 50,最大值為 1,000。如果帳戶群組數量大於頁面大小,回應會包含分頁符記,可用於擷取下一頁結果。
  • NEXT_PAGE_TOKEN:選用。這個方法先前回應中傳回的 nextPageToken 值。指定這個參數即可查詢更多帳戶群組。

HTTP 方法和網址:

GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

如要傳送要求,請選擇以下其中一個選項:

curl

執行下列指令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

執行下列指令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您應該會收到如下的 JSON 回應:

{
  "relatedAccountGroups": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId1"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId2"
    }
  ],
  "nextPageToken": "BenimQwKzIOibbOO2Lhisw"
}

程式碼範例

擷取相關帳戶群組成員資格

如要擷取行為相似的帳戶群組成員清單,請使用 relatedaccountgroupmemberships.list 方法。

使用任何要求資料之前,請先替換以下項目:

  • PROJECT_ID:您的 Google Cloud 專案 ID。
  • GROUP_ID:您要尋找相關成員資格的帳戶群組名稱。
  • PAGE_SIZE:選用。要在回應中納入的帳戶群組成員數。 預設值為 50,最大值為 1,000。如果帳戶群組成員人數大於頁面大小,回應會包含分頁符記,可用於擷取下一頁結果。
  • NEXT_PAGE_TOKEN:選用。這個方法先前回應中傳回的 nextPageToken 值。指定這個參數,即可查詢更多帳戶群組成員。

HTTP 方法和網址:

GET https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN

如要傳送要求,請選擇以下其中一個選項:

curl

執行下列指令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN"

PowerShell

執行下列指令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/relatedaccountgroups/GROUP_ID/memberships?page_size=PAGE_SIZE&page_token=NEXT_PAGE_TOKEN" | Select-Object -Expand Content

您應該會收到如下的 JSON 回應:

{
  "relatedAccountGroupMemberships": [
    {
      "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId1",
      "accountId": "4RopXS59"
    },
    {
      "name": "projects/projectId/relatedaccountgroups/groupId/memberships/membershipId2",
      "accountId": "HVMv1DTb"
    }
  ],
  "nextPageToken": "WPuIn8GHU3JvcJqgvmE7Aw"
}

程式碼範例

後續步驟