HTTP status codes and response formats

The server can return the following HTTP status codes:

  • 200 – successful method call
  • 4xx – incorrect parameters of the method
  • 5xx – an error on the server side

The body of the response contains XML. The standard response formats are described below.

Response format for the status code 200

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response xmlns="@link" xmlns:xsi="@link" xsi:schemaLocation="@link" version="1.0">
    <task id=”22345200-abe8-4f60-90c8-0d43c5f6c0f6”
        registrationTime=”2001-01-01T13:18:22Z”
        statusChangeTime=”2001-01-01T13:18:22Z”
        status=”Completed”
        error=”{An error message.}”
        filesCount=”10”
        credits=”10”
        estimatedProcessingTime=”3600”
        resultUrl=”http://<domain>/<blob ID>
        
        resultUrl2=”http://<domain>/<blob ID>
        resultUrl3=”http://<domain>/<blob ID>
        description=”My first OCR task”/>
    <task .../>
</response>
  • resultUrl – this attribute is only available for completed tasks. It provides the URL of the result of processing. The hyperlink has limited lifetime. If you want to download the result after that time has passed, use the getTaskStatus or listTasks method to obtain the new hyperlink.

    The GET request to download the result should not include any authorization headers. Using your Cloud OCR SDK authorization headers will result in an error.

  • resultUrl2 – this attribute is only available for completed tasks which were processed with multiple export formats. It provides the URL of the result saved in the second specified format. Otherwise, it has the same properties as the resultUrl attribute.
  • resultUrl3 – this attribute is only available for completed tasks which were processed with three export formats. It provides the URL of the result saved in the third specified format. Otherwise, it has the same properties as the resultUrl attribute.
  • filesCount – specifies the number of files in the task.
  • credits – specifies the cost of processing: it contains the estimated cost before task processing, and the actual cost, after the task has been completed. The measurement unit is the price of processing of one field.
  • estimatedProcessingTime – estimated time until the task is completed (in milliseconds). This attribute is available for the tasks with Queued or InProgress status.
  • error – description of the error occurred during processing. This attribute is available for the tasks with ProcessingFailed status only.

We do not recommend sending the same file for processing repeatedly, if the first task failed. However, if you have created several tasks for the same file, and all of them have failed, the fullest and most specific error description can be received by calling getTaskStatus for the first of those tasks.

Response format for the status codes 4xx and 5xx

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error xmlns="@link" xmlns:xsi="@link" xsi:schemaLocation="@link" version="1.0">
    <message language=”English”>
        {An error message.}
    </message>
</error>

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.