目录

About:get

Function

Obtains user information.

Scenario

By calling the About.get API, your app can obtain a user's Drive information, such as its storage quota and maximum size of a file that can be uploaded by the user.

Restrictions

The value of scope must be one of the following:
  • https://www.huawei.com/auth/drive.appdata
  • https://www.huawei.com/auth/drive.file
  • https://www.huawei.com/auth/drive
  • https://www.huawei.com/auth/drive.readonly
  • https://www.huawei.com/auth/drive.metadata
  • https://www.huawei.com/auth/drive.metadata.readonly

Prototype

Protocol

HTTP GET

Direction

Developer server -> HUAWEI Drive server

URL

https://driveapis.cloud.huawei.com.cn/drive/v1/about

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Path Parameters

None.

Query Parameters

Parameter

Mandatory/Optional

Type

Description

fields

Mandatory

string

Fields in the request, which are in the partial response format. For details, please refer to Overview.

form

Optional

string

Media format.

prettyPrint

Optional

boolean

Indicates whether to return a response in a human-readable format.

quotaId

Optional

string

User identifier, which can contain a maximum of 40 characters. This parameter is used to restrict the maximum number of API calls for a single user.

callback

Optional

string

Callback function used in JSONP requests.

Request Parameters

Request Header

Parameter

Mandatory/Optional

Type

Description

Authorization

Mandatory

string

User authorization information, that is, the access token (AT).

x-hw-trace-id

Optional

string

ID used for service tracing.

x-hw-app-id

Optional

string

App ID.

version

Optional

string

SDK version number.

x-hw-terminal

Optional

string

Device model.

x-hw-os

Optional

string

Device operating system.

unionID

Optional

string

User's UnionID.

User-Agent

Optional

string

App version number or app ID.

x-hw-deviceUUID

Optional

string

UUID of the device.

x-hw-deviceUDID

Optional

string

UDID of the device.

x-hw-appPackageName

Optional

string

App package name.

x-hw-network

Optional

string

Network type. The options include WiFi, 2G, 3G, 4G, 5G, and wire.

Request Body

None.

Request Example

GET https://driveapis.cloud.huawei.com.cn/drive/v1/about?fields=* HTTP/1.1 
Accept: application/json 
Cache-Control: no-cache 
Authorization: Bearer CF3NTYZSs7MRmxWyj8ssonQQxDgSPAjnDvrf+91NrpN22LdUrMA30A5Kzz0mf55sWao7e7VeLrmjQ0z2OmwPWlt3S00/L1BJppbTFhIgWb74ZBK8CFImUA==

Response Parameters

When the status code is 200:

Parameter

Type

Description

category

string

Resource type. The value is always drive#about.

dataVersion

string

Microservice. The options include v1.0 (vfs) and v2.0 (datamanager).

user.category

string

User type. The value is always drive#user.

user.displayName

string

Display name of the user.

user.profilePhotoLink

string

Link to the user's profile picture, which is not returned by default.

user.me

boolean

Indicates whether the user is the requesting user.

user.permissionId

string

Permission ID.

user.userAccount

string

Account of the user, which is not returned by default.

storageQuota.userCapacity

string

Total storage.

storageQuota.usedSpace

string

Used storage.

maxFileUploadSize

string

Maximum size of a file that can be uploaded.

maxThumbnailSize

integer

Maximum size of a thumbnail.

domain

string

Domain name of this site.

needUpdate

boolean

Indicates whether to update the security policy for the user.

updateUrl

string

URL of the web page for updating the security policy.

folderLevel

integer

Number of folder levels supported.

Response Example

{
    "storageQuota":{
        "usedSpace":"1458200675",
        "userCapacity":"5368709120"
    },
    "maxThumbnailSize":2097152,
    "needUpdate":false, // If the value is true, the user needs to update the security policy.
    "maxFileUploadSize":"53687091200",
    "domain":"driveapis.cloud.huawei.com.cn",
    "category":"drive#about",
    "user":{
        "permissionId":"233228122990838144",
        "displayName":"huaweiExample",
        "me":true,
        "category":"drive#user"
    },
    "folderLevel":10
}

Common Result Codes

The last four digits in the result code indicate the service error code, which is used to differentiate error scenarios. For details about other service error codes, please refer to Status Codes.

Status Code

Result Code

Response Code

Description

200

NA

-

Success.

400

21004001

LACK_OF_PARAM

Input parameter is missing. Check the parameter list.

400

21004002

PARAM_INVALID

Parameter verification failed. Check the parameter list.

403

21074033

AGREEMENT_NOT_SIGNED

The HUAWEI Drive user agreement is not signed. Try again after the agreement is signed.

403

21004032

SERVICE_NOT_SIPPORT

The service is not supported in the current country/region.

403

21084031

DATA_MIGRATINT

The security policy is being updated. Wait until security policy update is complete.

500

21055002

OUTER_SERVICE_UNAVAILABLE

External service is unavailable.

500

21085006

SERVER_TEMP_ERROR

Server error.

Call Example

    public static void main(String[] args) throws IOException{
        // Set the request URL and access token.
        String url = "https://driveapis.cloud.huawei.com.cn/drive/v1/about";
        String access_token = "CV6doD3HkAi7SGjrrWsDZDz0wkko0EQrWZDQKUZNZ/Sw8jytLWm5G1jQS3NtYF+wIWYCG9m3rVROTwg+8xpG6Jq55F0JDbxumn3/7SeatibxOh3sMbNgew==";
        // Obtain the user information.
        JSONObject aboutInfo = aboutGet(url, access_token);
        System.out.println(aboutInfo.toJSONString());

    }

    private static JSONObject aboutGet(String url, String access_token) throws IOException {
        StringBuilder stringBuilder = new StringBuilder("");
        stringBuilder.append("?").append("fields=*");
        HttpGet httpGet = new HttpGet(url + stringBuilder);
        httpGet.setHeader("Authorization","Bearer " + access_token);
        CloseableHttpResponse response = HttpClientUtil.getClient().execute(httpGet);

        try {
            HttpEntity responseEntity = response.getEntity();
            String ret = responseEntity != null ? EntityUtils.toString(responseEntity) : null;
            JSONObject jsonObject = (JSONObject) JSON.parse(ret);
            EntityUtils.consume(responseEntity);
            return jsonObject;
        }finally {
            response.close();
        }
    }