Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.
- What's New
- Function Overview
- Product Bulletin
- Service Overview
-
Billing
- Billing Overview
- Billing Modes
- Billing Items
- Billing Examples
- Billing Mode Changes
- Renewing Subscriptions
- Bills
- Arrears
- Billing Termination
- Cost Management
-
Billing FAQ
- Why Do I Get Additional Charges or Arrears After Purchasing a Package?
- Why Can I Still Call the Service and Incur Arrears When My Account Balance Is Zero?
- Why Do I Get Additional Charges or Arrears After Unsubscribing from an OCR Service?
- Can I Refund a Package After I Buy It?
- How Is Billing Handled When a Package Is Used Up? And How Can I Check the Remaining Quota and Receive Alerts for My Package?
- How Does a Member Account Use a Package Purchased by an Enterprise Master Account?
- What Is Fee Deduction Order for Multiple Packages?
- What are Grace Period and Retention Period?
- What Is Considered Valid Billing for OCR?
- Can Different API Packages Be Shared?
- Can OCR Be Charged by Project?
- Getting Started
- User Guide
- SDK Reference
- API Reference
-
FAQs
- Subscription
-
Token-based Authentication
- What Are the Username, Domain Name, and Project Name in the Token Message Body?
- Why Is the Error Message "The account is locked." Displayed?
- Why Is the Error Message "The username or password is wrong." Displayed?
- Why Does the Token Retrieval Process Return a 401 Status Code?
- Why Does the Token Fail to Be Obtained When I Use Postman to Call an ORC API?
- Why Don't I Have Programming Access Permissions?
- Why Does the Header Overflow When I Use Postman to Call an OCR API?
-
API
- How Do I View the API Usage?
- Why Is the Actual Number of API Calls Inconsistent with the Record Displayed on the Management Console?
- Does OCR Support Batch Processing?
- Can the OCR Results Be Converted into Word, TXT, or PDF Files?
- How Do I Obtain the Base64 Code of an Image?
- What Is the Number of Concurrent OCR API Calls?
- How Do I Use OCR APIs?
- Can the Region Where OCR Is Called Be Different from the Region Where OBS Resources Are Located?
- Can the Input Data of OCR Be Stored Locally?
- How Do I Improve the Recognition Speed?
- How Do I Convert a PDF to an Image?
- Can OCR Read Images from Non-Huawei Cloud Storage?
-
SDK
- Do OCR SDKs Need to Be Purchased?
- Do OCR SDKs Need Maven to Manage Dependency Packages?
- How Do I Change the Response Type in Returned Results?
- How Can I Fix an SSL Configuration Error?
- How Can I Fix a "connect timed out" Error?
- Why Does the Project ID Fail to Be Obtained?
- What Should I Do if I Forget My AK and SK?
-
Error Code
- Why Do I Fail to Call an OCR API?
- How Do I Handle the Error APIG.0301?
- How Do I Handle the Error APIG.0201?
- How Do I Handle the Error APIG.0101?
- How Do I Handle the Error APIG.0106?
- How Do I Handle the Error APIG.0308?
- How Do I Handle the Error ModelArts.0212?
- How Do I Handle the Error ModelArts.4603 or ModelArts.4704?
- How Do I Handle the Error ModelArts.4204?
- Permissions
- Data Security and Privacy
- Regions and AZs
- General Consulting
- Videos
- Glossary
- More Documents
- General Reference
Copied.
Making an API Request
This section describes the structure of a REST API request and demonstrates how to call an API.
Request URI
A request URI is in the following format:
{URI-scheme} :// {endpoint} / {resource-path} ? {query-string}
Although a request URI is included in the request header, most programming languages and frameworks require the request URI to be transmitted separately.
Parameter |
Description |
---|---|
URI-scheme |
Protocol used to transmit requests. All APIs use HTTPS. |
endpoint |
Domain name or IP address of the server bearing the REST service endpoint. The endpoint varies depending on services in different regions. For more details, see Endpoints. |
resource-path |
Path in which the requested resource is located, that is, the API access path. |
query-string |
Query parameter, which is optional. Ensure that a question mark (?) is included before each query parameter that is in the format of Parameter name=Parameter value. For example, limit=10 indicates that up to 10 data records will be displayed. |
For example, to call the API in the AP-Bangkok region, use the endpoint ocr.ap-southeast-2.myhuaweicloud.com of the AP-Bangkok region and find the value /v3/auth/tokens of resource-path in Obtaining a User Token. The URI is as follows:
https://ocr.ap-southeast-2.myhuaweicloud.com/v2/{project_id}/ocr/web-image

To simplify the URI display in this document, each API is provided only with a resource-path and a request method. The URI-scheme of all APIs is HTTPS, and the endpoints of all APIs in the same region are identical.
Request Methods
The HTTP protocol defines the following request methods that can be used to send a request to the server:
Method |
Description |
---|---|
GET |
Requests the server to return specified resources. |
PUT |
Requests the server to update specified resources. |
POST |
Requests the server to add resources or perform special operations. |
DELETE |
Requests the server to delete specified resources, for example, an object. |
HEAD |
Same as GET except that the server must return only the response header. |
PATCH |
Requests the server to update partial content of a specified resource. If the resource does not exist, a new resource will be created. |
POST https://ocr.ap-southeast-2.myhuaweicloud.com/v2/{project_id}/ocr/web-image
Request Header
You can also add additional header fields to a request, such as the fields required by a specified URI or HTTP method. For example, to request for the authentication information, add Content-Type, which specifies the request body type.
- Content-Type: request body type or format. This field is mandatory and its default value is application/json. Other values of this field will be provided for specific APIs if any.
- X-Auth-Token: user token. This field is required only for token-based API authentication. For details about the user token, see "Authentication".
The following provides an example request with a request header included.
POST https://ocr.ap-southeast-2.myhuaweicloud.com/v2/{project_id}/ocr/web-image Content-Type: application/json x-auth-token: MIIaBgYJKoZIhvcNAQcC...
Request Body
The body of a request is often sent in a structured format as specified in the Content-Type header field. The request body transfers all content except the request header.
The request body varies depending on APIs. Some APIs do not require the request body, for example, the APIs requested using the GET and DELETE methods.
The request parameters and parameter description are available in the request. The following provides an example request with a body included.
POST https://ocr.ap-southeast-2.myhuaweicloud.com/v2/{project_id}/ocr/web-image Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "image":"/9j/4AAQSkZJRgABAgEASABIAAD/4RFZRXhpZgAATU0AKgAAAAgABwESAAMAA..." }
If all data required for the API request is available, you can send the request to call the API through curl, Postman, or coding.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot