diff --git a/docs/apiu/guidelines/ALL_META.TXT.json b/docs/apiu/guidelines/ALL_META.TXT.json new file mode 100644 index 00000000..13f35599 --- /dev/null +++ b/docs/apiu/guidelines/ALL_META.TXT.json @@ -0,0 +1,185 @@ +[ + { + "dockw":"API Usage Guidelines" + }, + { + "uri":"apig-en-api-180328001.html", + "node_id":"apig-en-api-180328001.xml", + "product_code":"apiug", + "code":"1", + "des":"API requests sent by third-party applications to public cloud services must be authenticated using signatures.This document describes the signature procedure, provides sa", + "doc_type":"guidelines", + "kw":"Overview,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Overview", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328002.html", + "node_id":"apig-en-api-180328002.xml", + "product_code":"apiug", + "code":"2", + "des":"API Gateway provides RESTful APIs.REST provides APIs to create, query, update, delete, and access service resources.A REST API request/response pair is divided into the f", + "doc_type":"guidelines", + "kw":"Overview of REST APIs,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Overview of REST APIs", + "githuburl":"" + }, + { + "uri":"apig-en-api-180925010.html", + "node_id":"apig-en-api-180925010.xml", + "product_code":"apiug", + "code":"3", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"guidelines", + "kw":"Calling APIs", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Calling APIs", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328009.html", + "node_id":"apig-en-api-180328009.xml", + "product_code":"apiug", + "code":"4", + "des":"Obtain the required information before calling APIs.A project ID needs to be specified in the URIs of some APIs. Therefore, you need to obtain the project ID before calli", + "doc_type":"guidelines", + "kw":"Obtaining Required Information,Calling APIs,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Obtaining Required Information", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328003.html", + "node_id":"apig-en-api-180328003.xml", + "product_code":"apiug", + "code":"5", + "des":"If API requests are authenticated using tokens, the request header must contain X-Auth-Token (token information).This section describes how to call an API for token authe", + "doc_type":"guidelines", + "kw":"Token Authentication,Calling APIs,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Token Authentication", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328004.html", + "node_id":"apig-en-api-180328004.xml", + "product_code":"apiug", + "code":"6", + "des":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "doc_type":"guidelines", + "kw":"AK/SK Authentication", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"AK/SK Authentication", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328005.html", + "node_id":"apig-en-api-180328005.xml", + "product_code":"apiug", + "code":"7", + "des":"Log in to the management console.Click the username and choose My Credential from the drop-down list.Click Access Keys.Click Add Access Keys to switch to the Add Access K", + "doc_type":"guidelines", + "kw":"Generating an AK and SK,AK/SK Authentication,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Generating an AK and SK", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328006.html", + "node_id":"apig-en-api-180328006.xml", + "product_code":"apiug", + "code":"8", + "des":"Introduce the API Gateway signing SDK in the project.Download the API Gateway signing tool from the following link:https://apig-demo.obs.eu-de.otc.t-systems.com/java/java", + "doc_type":"guidelines", + "kw":"Signing a Request,AK/SK Authentication,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Signing a Request", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328008.html", + "node_id":"apig-en-api-180328008.xml", + "product_code":"apiug", + "code":"9", + "des":"This section describes how to call the API of a public cloud service by using Eclipse.The following code shows how to sign a request and how to use an HTTP client to send", + "doc_type":"guidelines", + "kw":"Sample Code,AK/SK Authentication,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"Sample Code", + "githuburl":"" + }, + { + "uri":"apig-en-api-180328012.html", + "node_id":"apig-en-api-180328012.xml", + "product_code":"apiug", + "code":"10", + "des":"Table 1 describes common status codes.", + "doc_type":"guidelines", + "kw":"HTTP Status Codes,API Usage Guidelines", + "search_title":"", + "metedata":[ + { + "documenttype":"guidelines", + "prodname":"apiug" + } + ], + "title":"HTTP Status Codes", + "githuburl":"" + } +] \ No newline at end of file diff --git a/docs/apiu/guidelines/CLASS.TXT.json b/docs/apiu/guidelines/CLASS.TXT.json new file mode 100644 index 00000000..27a58a15 --- /dev/null +++ b/docs/apiu/guidelines/CLASS.TXT.json @@ -0,0 +1,92 @@ +[ + { + "desc":"API requests sent by third-party applications to public cloud services must be authenticated using signatures.This document describes the signature procedure, provides sa", + "product_code":"apiug", + "title":"Overview", + "uri":"apig-en-api-180328001.html", + "doc_type":"guidelines", + "p_code":"", + "code":"1" + }, + { + "desc":"API Gateway provides RESTful APIs.REST provides APIs to create, query, update, delete, and access service resources.A REST API request/response pair is divided into the f", + "product_code":"apiug", + "title":"Overview of REST APIs", + "uri":"apig-en-api-180328002.html", + "doc_type":"guidelines", + "p_code":"", + "code":"2" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"apiug", + "title":"Calling APIs", + "uri":"apig-en-api-180925010.html", + "doc_type":"guidelines", + "p_code":"", + "code":"3" + }, + { + "desc":"Obtain the required information before calling APIs.A project ID needs to be specified in the URIs of some APIs. Therefore, you need to obtain the project ID before calli", + "product_code":"apiug", + "title":"Obtaining Required Information", + "uri":"apig-en-api-180328009.html", + "doc_type":"guidelines", + "p_code":"3", + "code":"4" + }, + { + "desc":"If API requests are authenticated using tokens, the request header must contain X-Auth-Token (token information).This section describes how to call an API for token authe", + "product_code":"apiug", + "title":"Token Authentication", + "uri":"apig-en-api-180328003.html", + "doc_type":"guidelines", + "p_code":"3", + "code":"5" + }, + { + "desc":"HUAWEI CLOUD Help Center presents technical documents to help you quickly get started with HUAWEI CLOUD services. The technical documents include Service Overview, Price Details, Purchase Guide, User Guide, API Reference, Best Practices, FAQs, and Videos.", + "product_code":"apiug", + "title":"AK/SK Authentication", + "uri":"apig-en-api-180328004.html", + "doc_type":"guidelines", + "p_code":"3", + "code":"6" + }, + { + "desc":"Log in to the management console.Click the username and choose My Credential from the drop-down list.Click Access Keys.Click Add Access Keys to switch to the Add Access K", + "product_code":"apiug", + "title":"Generating an AK and SK", + "uri":"apig-en-api-180328005.html", + "doc_type":"guidelines", + "p_code":"6", + "code":"7" + }, + { + "desc":"Introduce the API Gateway signing SDK in the project.Download the API Gateway signing tool from the following link:https://apig-demo.obs.eu-de.otc.t-systems.com/java/java", + "product_code":"apiug", + "title":"Signing a Request", + "uri":"apig-en-api-180328006.html", + "doc_type":"guidelines", + "p_code":"6", + "code":"8" + }, + { + "desc":"This section describes how to call the API of a public cloud service by using Eclipse.The following code shows how to sign a request and how to use an HTTP client to send", + "product_code":"apiug", + "title":"Sample Code", + "uri":"apig-en-api-180328008.html", + "doc_type":"guidelines", + "p_code":"6", + "code":"9" + }, + { + "desc":"Table 1 describes common status codes.", + "product_code":"apiug", + "title":"HTTP Status Codes", + "uri":"apig-en-api-180328012.html", + "doc_type":"guidelines", + "p_code":"", + "code":"10" + } +] \ No newline at end of file diff --git a/docs/apiu/guidelines/PARAMETERS.txt b/docs/apiu/guidelines/PARAMETERS.txt new file mode 100644 index 00000000..6da8d5f0 --- /dev/null +++ b/docs/apiu/guidelines/PARAMETERS.txt @@ -0,0 +1,3 @@ +version="" +language="en-us" +type="" \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328001.html b/docs/apiu/guidelines/apig-en-api-180328001.html new file mode 100644 index 00000000..86c2e871 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328001.html @@ -0,0 +1,7 @@ + + +

Overview

+

API requests sent by third-party applications to public cloud services must be authenticated using signatures.

+

This document describes the signature procedure, provides sample code to illustrate how to use the default signer to sign requests and how to use the HTTP client to send requests.

+
+ diff --git a/docs/apiu/guidelines/apig-en-api-180328002.html b/docs/apiu/guidelines/apig-en-api-180328002.html new file mode 100644 index 00000000..309246c4 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328002.html @@ -0,0 +1,193 @@ + + +

Overview of REST APIs

+

API Gateway provides RESTful APIs.

+

REST provides APIs to create, query, update, delete, and access service resources.

+

A REST API request/response pair is divided into the following parts:

+ +

Request URI

A request URI consists of the following parts:

+

{URI-scheme} :// {Endpoint} / {resource-path} ? {query-string}

+

Although a request URI is a part of a request header, most programming languages or frameworks require the request URI to be separately transmitted, rather than being conveyed in a request message.

+ +
+ + + + + + + + + + + + + + + + +
Table 1 URI parameter description

Parameter

+

Description

+

URI-scheme

+

Protocol used to transmit the request.

+

Endpoint

+

Domain name or IP address of the server where the RESTful service endpoint is hosted. You can obtain the value from Regions and Endpoints.

+

resource-path

+

Path in which the resource requested by the API is located. The path is provided by the URI module of APIs, for example, v3/auth/tokens.

+

Query string

+

This is an optional parameter. For example, the value can be the API version or resource selection criteria.

+
+
+
+

Request Method

HTTP method: the type of requested operation.

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
Table 2 HTTP methods supported

Method

+

Description

+

GET

+

Requests a server to provide a specified resource.

+

PUT

+

Requests a server to update a specified resource.

+

POST

+

Requests a server to add resources or perform special operations.

+

DELETE

+

Requests a server to delete a specified resource, for example, an object.

+

HEAD

+

Similar to the GET method, the HEAD method requests a server to provide the specified resource, but the server returns only the response header (excluding the response body) to this request.

+

PATCH

+

Requests a server to update a part of a specified resource.

+

If the resource does not exist, the PATCH method may create a new resource.

+
+
+
+

Request Headers

Optional header fields: For example, such fields could be those required by a specified URI and HTTP method. Table 3 describes common HTTP request header fields.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 3 Common request headers

Header

+

Description

+

Remarks

+

Example

+

Content-Type

+

Type (or format) of the message body.

+

Mandatory

+

application/json

+

X-Auth-Token

+

Token authentication information, which can be obtained by following the procedure in Token Authentication.

+

Mandatory if token authentication is used.

+

-

+

X-Sdk-Date

+

Time at which the request was sent.

+

Mandatory if AK/SK authentication is used.

+

20151222T034042Z

+

Authorization

+

Signature authentication information, which comes from the request signature result.

+

Mandatory if AK/SK authentication is used.

+

-

+

+
+
+
+

Request Body (Optional)

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

+
+

Response Headers

A response header consists of an HTTP status code and additional response header fields.

+ +
+

Response Body (Optional)

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.

+
+

Initiating Requests

A request can be initiated by using any of the following methods:

+ +
+
+
+ diff --git a/docs/apiu/guidelines/apig-en-api-180328003.html b/docs/apiu/guidelines/apig-en-api-180328003.html new file mode 100644 index 00000000..6b41a747 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328003.html @@ -0,0 +1,80 @@ + + +

Token Authentication

+

Application Scenarios

If API requests are authenticated using tokens, the request header must contain X-Auth-Token (token information).

+

This section describes how to call an API for token authentication.

+
+

Procedure

  1. Send POST https://IAM endpoint/v3/auth/tokens to obtain the IAM endpoint and the region name in the message body.

    See Regions and Endpoints.

    +

    +

    A cloud service can be deployed globally or at the project level.

    +
    • A project-level service requires a project-level token. When you call the API, set auth.scope in the request body to project. The following services are at the project level: AOM, APIG, AS, BMS, CBR, CCE, Cloud Eye, CSBS, CSS, CTS, DataArts Studio, DC, DCS, DDS, Dedicated WAF, DeH, DIS, DLI, DMS, DNS, DRS, DWS, ECS, EIP, ELB, EVS, GaussDB (for MySQL), GaussDB NoSQL, IMS, KMS, LTS, ModelArts, MRS, NAT, PLAS, RDS, RTS, SDRS, SFS, SMN, SWR, VBS, VPC, VPCEP, VPN, and WAF.
    • A global service requires a global token. When you call the API, set auth.scope in the request body to domain. The following services are global ones: Anti-DDoS, IAM, OBS, TMS, and TMS.
    +
    The following shows an example of a project-level service request:

    Replace the texts in italic with actual ones. For details, see Identity and Access Management API Reference.

    +

    Log in to the management console, click your username in the upper right corner, and choose My Credential from the drop-down list. On the My Credentials page, obtain your username, domain name, and project ID.

    +
    +
    {
    +  "auth": {
    +    "identity": {
    +      "methods": [
    +        "password"
    +      ],
    +      "password": {
    +        "user": {
    +          "name": "username", // IAM username
    +          "password": "password",  // IAM user password
    +          "domain": {
    +            "name": "domainname" // Name of the domain to which the IAM user belongs
    +          }
    +        }
    +      }
    +    },
    +    "scope": {
    +      "project": {
    +        "id": "0215ef11e49d4743be23dd97a1561e91" // Project ID
    +      }
    +    }
    +  }
    +}
    +
    +

    The following shows an example of a global service request:

    +
    {
    +    "auth": {
    +        "identity": {
    +            "methods": [
    +                "password"
    +            ],
    +            "password": {
    +                "user": {
    +                    "name": "username",   // IAM username
    +                    "password": "password",  // IAM user password
    +                    "domain": {
    +                        "name": "domainname"  // Name of the domain to which the IAM user belongs
    +                    }
    +                }
    +            }
    +        },
    +        "scope": {
    +            "domain": {
    +                "name": "domainname"    // Name of the domain to which the IAM user belongs
    +            }
    +        }
    +    }
    +}
    +
  2. Obtain the token. For details, see section "Obtaining the User Token" in the Identity and Access Management API Reference. If the request is successful, the value of the X-Subject-Token header in the response is the token.

    The following figures illustrate how to use Postman to manually obtain a token.

    +
    Figure 1 Example request
    +
    Figure 2 Obtain X-Subject-Token from the header of the response message.
    +
  3. Call a service API, add the X-Auth-Token header with the token obtained in 2.
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328004.html b/docs/apiu/guidelines/apig-en-api-180328004.html new file mode 100644 index 00000000..d6636774 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328004.html @@ -0,0 +1,36 @@ + + +

AK/SK Authentication

+

When you use API Gateway to send requests to underlying services, the requests must be signed using the AK and SK.

+

AK is a unique identifier that is associated with a secret access key; the access key ID and secret access key are used together to sign requests cryptographically.

+

SK is a key that is used in conjunction with an access key ID to cryptographically sign requests. Signing a request identifies the sender and prevents the request from being altered.

+
+

The AK/SK authentication process is as follows:

+
  1. A standard request is created.
  2. A to-be-signed string is created using the request and other related information.
  3. A signature is calculated using the AK/SK and to-be-signed string.
  4. The generated signature is added as a header or a query parameter in the HTTP request.
  5. After receiving the request, API Gateway performs 1 to 3 to calculate a signature.
  6. The new signature is compared with the signature generated in 3. If they are consistent, the request is processed; otherwise, the request is rejected.
+

Figure 1 shows the process of calling APIs through AK/SK authentication.

+
Figure 1 API calling process flow
+
  • If a failure occurs in any step, the failure will be returned to the client application.
  • The cached token is valid for 15 minutes by default.
+
+
+
+ + + +
+ + + \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328005.html b/docs/apiu/guidelines/apig-en-api-180328005.html new file mode 100644 index 00000000..c3ad9f8b --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328005.html @@ -0,0 +1,15 @@ + + +

Generating an AK and SK

+
  1. Log in to the management console.
  2. Click the username and choose My Credential from the drop-down list.
  1. Click Access Keys.
  2. Click Add Access Keys to switch to the Add Access Keys page.
  3. Enter your login password.
  4. Enter the verification code sent to your mailbox or mobile phone.
    • Users that are created in IAM without specifying email addresses or mobile numbers only need to enter their login passwords.
    • MyWorkplace users are not required to enter their login passwords. They can create new access keys without entering verification codes if no email addresses or mobile numbers have been specified.
    +
    +
  1. Click OK to download the access key.

    Keep the AK/SK file confidential to prevent information leakage.

    +
    +
+
+
+ +
+ diff --git a/docs/apiu/guidelines/apig-en-api-180328006.html b/docs/apiu/guidelines/apig-en-api-180328006.html new file mode 100644 index 00000000..7adb26ef --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328006.html @@ -0,0 +1,25 @@ + + +

Signing a Request

+
  1. Introduce the API Gateway signing SDK in the project.
    1. Download the API Gateway signing tool from the following link:

      https://apig-demo.obs.eu-de.otc.t-systems.com/java/java-sdk-core.zip

      +
    2. Decompress the downloaded package to obtain a .jar file.
    3. Add the decompressed .jar file to a project, for example, Eclipse, as a dependency package. See the following figure.

      +
    +
  2. Sign the request.

    The signing method is integrated into the .jar file added in 1. Before sending the request, sign the requested content. The signature obtained is included in the HTTP header of the request.

    +

    For details, see Sample Code.

    +

    The JDK version cannot be earlier than 1.8.

    +
    +
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328008.html b/docs/apiu/guidelines/apig-en-api-180328008.html new file mode 100644 index 00000000..353ea6d0 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328008.html @@ -0,0 +1,79 @@ + + +

Sample Code

+

Scenario

This section describes how to call the API of a public cloud service by using Eclipse.

+
The following code shows how to sign a request and how to use an HTTP client to send an HTTPS request. The code is categorized into three classes:
  • AccessService: an abstract class that merges the GET, POST, PUT, and DELETE methods into the access method.
  • Demo: execution entry that simulates GET, POST, PUT, and DELETE requests.
  • AccessServiceImpl: implementation of the access method. The code required for API Gateway communication is included in the access method.
+
+

You can download the sample code package from https://apig-demo.obs.eu-de.otc.t-systems.com/java/SdkDemo.zip.

+

The JDK version cannot be earlier than 1.8.

+
+
+

Procedure

  1. Download the sample code package and decompress it.
  2. Import the sample project to Eclipse.
    Figure 1 Selecting an existing project
    +
    Figure 2 Selecting the sample code file after decompression
    +
    Figure 3 Structure of the project after importing
    +
  3. Edit the main method in the Demo.java file.

    Replace the bold texts with actual values. If you use other methods, such as POST, PUT, and DELETE, see the corresponding annotations.

    +

    Replace the parameters in the URL, for example, project_id.

    +

    For details on how to obtain your region name, service name, AK/SK, project ID, and domain ID, see Obtaining Required Information.

    +
    //TODO: Replace eu-de with the name of the region in which the service to be accessed is located.
    +private static final String region = "eu-de";
    +
    +//TODO: Replace vpc with the name of the service you want to access. For example, ecs, vpc, iam, and elb.
    +private static final String serviceName = "vpc";
    +
    +public static void main(String[] args) throws UnsupportedEncodingException
    +{
    +//TODO: Replace the AK and SK with those obtained on the My Credential page.
    +String ak = "ZIRRKMTWPTQFQI1WKNKB";
    +String sk = "Us0mdMNHk******YrRCnW0ecfzl";
    +
    +//TODO: To specify a project ID (multi-project scenarios), add the X-Project-Id header.
    +//TODO: To access a global service, such as IAM, DNS, CDN, and TMS, add the X-Domain-Id header to specify an account ID.
    +//TODO: To add a header, find "Add special headers" in the AccessServiceImple.java file.
    +
    +//TODO: Test the API
    +String url = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/vpcs/{vpc_id}";
    +get(ak, sk, url);
    +
    +//TODO: When creating a VPC, replace {project_id} in postUrl with the actual value.
    +//String postUrl = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/cloudservers";
    +//String postbody ="{\"vpc\": {\"name\": \"vpc\",\"cidr\": \"192.168.0.0/16\"}}";
    +//post(ak, sk, postUrl, postbody);
    +
    +//TODO: When querying a VPC, replace {project_id} in url with the actual value.
    +//String url = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/vpcs/{vpc_id}";
    +//get(ak, sk, url);
    +
    +//TODO: When updating a VPC, replace {project_id} and {vpc_id} in putUrl with the actual values.
    +//String putUrl = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/vpcs/{vpc_id}";
    +//String putbody ="{\"vpc\":{\"name\": \"vpc1\",\"cidr\": \"192.168.0.0/16\"}}";
    +//put(ak, sk, putUrl, putbody);
    +
    +//TODO: When deleting a VPC, replace {project_id} and {vpc_id} in deleteUrl with the actual values.
    +//String deleteUrl = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/vpcs/{vpc_id}";
    +//delete(ak, sk, deleteUrl);
    +}
    +
  4. (Optional) To call a service API of a sub-project or to add a self-defined header, perform the following steps:
    1. In the main method in the Demo.java file, replace project_id with the sub-project ID of the API.
      //TODO: Test the API
      +String url = "https://vpc.eu-de.otc.t-systems.com/v1/{project_id}/vpcs/{vpc_id}";
      +get(ak, sk, url);
      +
    2. Locate the following lines in the AccessServiceImpl.java file, delete "//" to activate the code line, and replace the sub-project ID with the actual one.
      //TODO: Add special headers.
      +//request.addHeader("X-Project-Id", "xxxxx");
      +
    3. Repeat 4.b to add other self-defined headers.
    +
  5. Compile and run the API calling code.

    Find Demo.java in the left pane of the Package Explorer, right-click, and choose Run AS > Java Application.

    +

    View the API call logs on the console.

    +
+
+

+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328009.html b/docs/apiu/guidelines/apig-en-api-180328009.html new file mode 100644 index 00000000..e708eea7 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328009.html @@ -0,0 +1,114 @@ + + +

Obtaining Required Information

+

Obtain the required information before calling APIs.

+

Required Information

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1 Required information

Item

+

Parameter

+

Description

+

Service name

+

serviceName

+

Service name, for example, iam, vpc, and ecs.

+

Region/Endpoint

+

-

+

Region and endpoint.

+

See Regions and Endpoints.

+

Project ID

+

project_id

+

Project ID, which is configured in the URI in most cases.

+

For details about how to obtain the value of this parameter, see Obtaining a Project ID.

+

username/password

+

username/password

+

Username and password, which are used to obtain a token in token authentication mode.

+

AK/SK

+

ak/sk

+

AK/SK pair.

+

It is used in AK/SK authentication mode.

+

For details about how to obtain the value of this parameter, see Generating an AK and SK.

+

uri

+

uri

+

Request path and parameters.

+

Obtain the URI according to the API reference guide of each service.

+

Domain Name

+

-

+

Account name, which is used to obtain a token in token authentication mode.

+

For details about how to obtain the value of this parameter, see Obtaining the Domain Name and Domain ID.

+

Domain ID

+

X-Domain-Id

+

Account ID, which is used to:

+
  • Obtain a token in token authentication mode.
  • Access global services, such as IAM, DNS, and CDN, in AK/SK authentication mode. You must specify a domain ID in the header.
+

For details about how to obtain the value of this parameter, see Obtaining the Domain Name and Domain ID.

+

Sub-project ID

+

X-Project-Id

+

Sub-project ID, which is used in multi-project scenarios.

+

For details about how to obtain the value of this parameter, see Obtaining a Project ID.

+
+
+
+

Obtaining a Project ID

A project ID needs to be specified in the URIs of some APIs. Therefore, you need to obtain the project ID before calling APIs. The following procedure describes how to obtain a project ID:

+
  1. Log in to the management console.
  2. Click the username and choose My Credential from the drop-down list.

    On the My Credential page, view project IDs in the project list.

    +
    Figure 1 Viewing project IDs
    +

    In multi-project scenarios, expand the region, and obtain your sub-project ID from the Project ID column.

    +
+
+

Obtaining the Domain Name and Domain ID

When you call APIs, your domain name and domain ID are required in some URLs. Obtain your domain name and domain ID on the console by performing the following steps:

+
  1. Log in to the management console.
  1. Click the username and choose My Credential from the drop-down list.

    On the My Credential page, view the domain name and domain ID.

    +
    Figure 2 Viewing the domain name and domain ID
    +
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/apiu/guidelines/apig-en-api-180328012.html b/docs/apiu/guidelines/apig-en-api-180328012.html new file mode 100644 index 00000000..551b7308 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180328012.html @@ -0,0 +1,107 @@ + + +

HTTP Status Codes

+

Table 1 describes common status codes.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1 HTTP request status codes

Return Value

+

Description

+

200 OK

+

The request has been processed successfully.

+

204 No Content

+

The server does not return any information.

+

400 Bad Request

+

The server failed to process the request. Possible causes include:

+
  1. The request could not be parsed by the server due to incorrect syntax.
  2. Request parameters are incorrect.
+

401 Unauthorized

+

The request requires user authentication. For example, the username and password are required.

+

403 Forbidden

+

You are forbidden to access the requested page.

+

404 Not Found

+

The request failed because the requested resource could not be found on the server.

+

405 Method Not Allowed

+

You are not allowed to use the method specified in the request.

+

406 Not Acceptable

+

The response generated by the server could not be accepted by the client.

+

407 Proxy Authentication Required

+

You must use the proxy server for authentication so that the request can be processed.

+

408 Request Timeout

+

The request timed out.

+

409 Conflict

+

The request could not be processed due to a conflict.

+

410 Gone

+

The requested resource is not available on the server and no known forwarding address is provided.

+

412 Precondition Failed

+

One or more conditions specified in the request header are not met when the server tests the conditions.

+

500 Internal Server Error

+

The server failed to process the request due to an unexpected condition.

+

501 Not Implemented

+

Failed to complete the request because the server does not support the requested function.

+

502 Bad Gateway

+

Failed to complete the request because the server has received an invalid response.

+

503 Service Unavailable

+

Failed to complete the request because the service is unavailable.

+

504 Gateway Timeout

+

The gateway timed out.

+
+
+
+ diff --git a/docs/apiu/guidelines/apig-en-api-180925010.html b/docs/apiu/guidelines/apig-en-api-180925010.html new file mode 100644 index 00000000..ac5b1899 --- /dev/null +++ b/docs/apiu/guidelines/apig-en-api-180925010.html @@ -0,0 +1,16 @@ + + +

Calling APIs

+

+
+
+ +
+ diff --git a/docs/apiu/guidelines/en-us_image_0132432937.png b/docs/apiu/guidelines/en-us_image_0132432937.png new file mode 100644 index 00000000..94736e3a Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132432937.png differ diff --git a/docs/apiu/guidelines/en-us_image_0132432939.png b/docs/apiu/guidelines/en-us_image_0132432939.png new file mode 100644 index 00000000..0adf514b Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132432939.png differ diff --git a/docs/apiu/guidelines/en-us_image_0132451568.jpg b/docs/apiu/guidelines/en-us_image_0132451568.jpg new file mode 100644 index 00000000..b0e263d9 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132451568.jpg differ diff --git a/docs/apiu/guidelines/en-us_image_0132453772.png b/docs/apiu/guidelines/en-us_image_0132453772.png new file mode 100644 index 00000000..a24ff602 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132453772.png differ diff --git a/docs/apiu/guidelines/en-us_image_0132518357.png b/docs/apiu/guidelines/en-us_image_0132518357.png new file mode 100644 index 00000000..508f4c13 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132518357.png differ diff --git a/docs/apiu/guidelines/en-us_image_0132557229.png b/docs/apiu/guidelines/en-us_image_0132557229.png new file mode 100644 index 00000000..1cc55fc0 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0132557229.png differ diff --git a/docs/apiu/guidelines/en-us_image_0139098594.png b/docs/apiu/guidelines/en-us_image_0139098594.png new file mode 100644 index 00000000..52cbcd96 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0139098594.png differ diff --git a/docs/apiu/guidelines/en-us_image_0139099203.png b/docs/apiu/guidelines/en-us_image_0139099203.png new file mode 100644 index 00000000..7331ada4 Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0139099203.png differ diff --git a/docs/apiu/guidelines/en-us_image_0161965716.png b/docs/apiu/guidelines/en-us_image_0161965716.png new file mode 100644 index 00000000..e237161f Binary files /dev/null and b/docs/apiu/guidelines/en-us_image_0161965716.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/caution_3.0-en-us.png b/docs/apiu/guidelines/public_sys-resources/caution_3.0-en-us.png new file mode 100644 index 00000000..60f60762 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/caution_3.0-en-us.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/danger_3.0-en-us.png b/docs/apiu/guidelines/public_sys-resources/danger_3.0-en-us.png new file mode 100644 index 00000000..47a9c723 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/danger_3.0-en-us.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/delta.gif b/docs/apiu/guidelines/public_sys-resources/delta.gif new file mode 100644 index 00000000..0d1b1f67 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/delta.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/deltaend.gif b/docs/apiu/guidelines/public_sys-resources/deltaend.gif new file mode 100644 index 00000000..cc7da0fc Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/deltaend.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-arrowdn.gif b/docs/apiu/guidelines/public_sys-resources/icon-arrowdn.gif new file mode 100644 index 00000000..37942803 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-arrowdn.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-arrowrt.gif b/docs/apiu/guidelines/public_sys-resources/icon-arrowrt.gif new file mode 100644 index 00000000..6aaaa11c Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-arrowrt.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-caution.gif b/docs/apiu/guidelines/public_sys-resources/icon-caution.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-caution.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-danger.gif b/docs/apiu/guidelines/public_sys-resources/icon-danger.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-danger.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-huawei.gif b/docs/apiu/guidelines/public_sys-resources/icon-huawei.gif new file mode 100644 index 00000000..a31d60f8 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-huawei.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-note.gif b/docs/apiu/guidelines/public_sys-resources/icon-note.gif new file mode 100644 index 00000000..31be2b03 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-note.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-notice.gif b/docs/apiu/guidelines/public_sys-resources/icon-notice.gif new file mode 100644 index 00000000..40907065 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-notice.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-tip.gif b/docs/apiu/guidelines/public_sys-resources/icon-tip.gif new file mode 100644 index 00000000..c47bae05 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-tip.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/icon-warning.gif b/docs/apiu/guidelines/public_sys-resources/icon-warning.gif new file mode 100644 index 00000000..079c79b2 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/icon-warning.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/imageclose.gif b/docs/apiu/guidelines/public_sys-resources/imageclose.gif new file mode 100644 index 00000000..3a3344af Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/imageclose.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/imageclosehover.gif b/docs/apiu/guidelines/public_sys-resources/imageclosehover.gif new file mode 100644 index 00000000..8699d5e3 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/imageclosehover.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/imagemax.gif b/docs/apiu/guidelines/public_sys-resources/imagemax.gif new file mode 100644 index 00000000..99c07dc2 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/imagemax.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/imagemaxhover.gif b/docs/apiu/guidelines/public_sys-resources/imagemaxhover.gif new file mode 100644 index 00000000..d01d77d6 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/imagemaxhover.gif differ diff --git a/docs/apiu/guidelines/public_sys-resources/macFFBgHack.png b/docs/apiu/guidelines/public_sys-resources/macFFBgHack.png new file mode 100644 index 00000000..ec811470 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/macFFBgHack.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/note_3.0-en-us.png b/docs/apiu/guidelines/public_sys-resources/note_3.0-en-us.png new file mode 100644 index 00000000..57a0e1f5 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/note_3.0-en-us.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/notice_3.0-en-us.png b/docs/apiu/guidelines/public_sys-resources/notice_3.0-en-us.png new file mode 100644 index 00000000..fa4b6499 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/notice_3.0-en-us.png differ diff --git a/docs/apiu/guidelines/public_sys-resources/warning_3.0-en-us.png b/docs/apiu/guidelines/public_sys-resources/warning_3.0-en-us.png new file mode 100644 index 00000000..def5c356 Binary files /dev/null and b/docs/apiu/guidelines/public_sys-resources/warning_3.0-en-us.png differ