Updated on 2022-02-22 GMT+08:00

Common APIs

Common APIs can be used to access various AI services on HUAWEI CLOUD. For details about the AI services, see the related service documentation.

  • API calling

    hilens.EIServices.Request(method, host, uri, queryParams, payload, headers)

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    method

    Yes

    Enumeration

    Request method. The value can be hilens.GET, hilens.POST, hilens.PUT, or hilens.DELETE.

    host

    Yes

    Character string

    Request domain name. host and uri comprise a complete request URL.

    uri

    Yes

    Character string

    Request URI. host and uri comprise a complete request URL.

    queryParams

    Yes

    Character string

    String to be queried.

    payload

    Yes

    Character string

    Request body.

    headers

    Yes

    Character string

    Request header. The hilens.EIHeaders() object is provided for adding request headers. The following is an example:

    headers = hilens.EIHeaders()

    headers.add("Content-Type: application/json")

  • Return value
    EIResponse structure, including requestState and responseBody. For details, see Table 2.
    Table 2 Return value description

    Parameter

    Type

    Description

    EIResponse.requestState

    Boolean

    Request status. True indicates a success, and False indicates a failure.

    EIResponse.responseBody

    Character string

    Request response body.