skip to Main Content

I’m trying to annotate an assessment, for now from Postman but I’m getting 404 error from the URL that is posted on Google’s guide. The URL I’m trying is

https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/assessments/ASSESSMENT_ID

Of course substituting variables for my values. The body of the post request is

{
"annotation": "LEGITIMATE"
}

The response I get is 404. I even tried https://recaptchaenterprise.googleapis.com and this also returns 404. I wonder if the URL has changed.

Also if this is possible to do with the PHP SDK that would be better.

2

Answers


  1. Chosen as BEST ANSWER

    I dug around in recaptcha's sdk and found a method for annotation. This is not documented anywhere.

    use GoogleCloudRecaptchaEnterpriseV1AnnotateAssessmentRequestAnnotation;
    use GoogleCloudRecaptchaEnterpriseV1AnnotateAssessmentResponse;
    use GoogleCloudRecaptchaEnterpriseV1RecaptchaEnterpriseServiceClient;
    
    require 'vendor/autoload.php';
    
    $assessment = 'YOUR ASSESSMENT ID'; // /projects/PROJECT_ID/assessments/ASSESSMENT_ID
    try {
        $client = new RecaptchaEnterpriseServiceClient([
            'credentials' => __DIR__.'/../vault/'.RECAPTCHA_SERVICE_CREDEN
        ]);
    
      $client->annotateAssessment($assessment, 1); // 1 = Legitimate, 2 = Fraudulent
    
    } catch (Exception $e){
        $response['error'] = 'An error occurred: '.$e->getMessage();
    }
    

  2. Typically, this occurs if the project ID is incorrect or if authentication failed for that project.

    You can check this public documentation as guidance.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search