1
0
forked from docs/doc-exports
doc-exports/docs/ocr/api-ref/ocr_03_0006.html
Sheng, Lichang f0fbeaa320 OCR api 20240111 v2
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-committed-by: Sheng, Lichang <lichangsheng1@noreply.gitea.eco.tsi-dev.otc-service.com>
2024-01-17 10:01:47 +00:00

7.7 KiB

Response

After sending a request, you will receive a response, including a status code, response header, and response body.

Status Codes

A status code is a group of digits, ranging from 1xx to 5xx. It indicates the status of a request. For more information, see Status Codes.

If status code 201 is returned, the request is successful.

Response Header

Similar to a request, a response also has a header, for example, Content-Type.

Table 1 Common response headers

Header

Description

Mandatory

Content-Type

Media type of the response body sent to a recipient

Type: string

Default value: application/json; charset=UTF-8

Yes

X-request-id

Request ID for task tracing

Type: string request_id-timestamp-hostname (request_id is the UUID generated on the server. timestamp indicates the current timestamp, and hostname is the name of the server that processes the current API.)

Default value: none

No

X-ratelimit

Total number of flow control requests

Type: integer

Default value: none

No

X-ratelimit-used

Number of remaining requests

Type: integer

Default value: none

No

X-ratelimit-window

Flow control unit

Type: string. The unit is in minute, hour, or day.

Default value: hour

No

The message header shown in Figure 3-1 is returned.

x-subject-token is the desired user token. This token can then be used to authenticate the calling of other APIs.

Figure 1 Header fields of the response to the request for obtaining a user token

Response Body

A response body conveys information other than the response header and is generally sent in a structured format (for example, JSON or XML) defined by the Content-Type field in the response header.

The following message body is returned. The following is part of the response body:

{ 
    "token": { 
        "expires_at": "2019-02-13T06:52:13.855000Z", 
        "methods": [ 
            "password" 
        ], 
        "catalog": [ 
            { 
                "endpoints": [ 
                    { 
                        "region_id": "********", 
......

If an error occurs during API calling, an error code and error message will be displayed. An error response body is shown as follows:

{  
    "error_msg": "The input parameter is invalid.",  
    "error_code": "AIS.0101"  
}

In the error response body, error_code is an error code, and error_msg provides information about the error. For more information, see Error Codes.