google-cloud-platformgoogle-cloud-visionvision-api

Google Cloud Vision Api only return "name"


I am trying to use Google Cloud Vision API.

I am using the REST API in this link.

POST https://vision.googleapis.com/v1/files:asyncBatchAnnotate

My request is

{
    "requests": [
        {
            "inputConfig": {
                "gcsSource": {
                    "uri": "gs://redaction-vision/pdf_page1_employment_request.pdf"
                },
                "mimeType": "application/pdf"
            },
            "features": [
                {
                    "type": "DOCUMENT_TEXT_DETECTION"
                }
            ],
            "outputConfig": {
                "gcsDestination": {
                    "uri": "gs://redaction-vision"
                }
            }
        }
    ]
}

But the response is always only "name" like below:

{
    "name": "operations/a7e4e40d1e1ac4c5"
}

My "gs" location is valid. When I write the wrong path in "gcsSource", 404 not found error is coming. Who knows why my response is weird?


Solution

  • This is expected, it will not send you the output as a HTTP response. To see what the API did, you need to go to your destination bucket and check for a file named "xxxxxxxxoutput-1-to-1.json", also, you need to specify the name of the object in your gcsDestination section, for example: gs://redaction-vision/test.