Calling APIs

Preparation

To call an API, do as follows:

  1. Obtain an API.

    You can obtain an API from the service market of DLM.

  2. Create and authorize an application. See Creating an Application and Getting Authorized for details.

    To call an API that is accessed through application authentication, you must create an application to generate an application ID and key pair (AppKey and AppSecret). You can call the API only after you bind the application to it. Provide your application information to the API developer to get authorized. When an API is called, the key pair replaces the one in the SDK, and DLM authenticates the identity of the API caller by verifying the key pair. For details on how to use the application authentication method, see the DLM SDK Reference.

  3. Call an API.

    After completing the preceding operations, you can call an API by following the procedures in Calling an API.

Creating an Application and Getting Authorized

Creating an application

  1. Log in to the DGC console, select a DGC instance, and click Access.

    On the displayed page, click the Workspaces tab. In the workspace list, locate the required workspace.

  1. Click Data Lake Mall of the corresponding workspace.

    Navigate to the Data Lake Mall console.

  2. Choose API Calling > Apps. On the displayed page, click Create. The Create App dialog box is displayed. Set the parameters listed in Table 1.
    Table 1 App information

    Parameter

    Description

    Name

    The name of the application to be created.

    Applied To

    Exclusive DLM, which does not connect to a gateway.

    Exclusive ROMA_APIC, which connects to the ROMA APIC gateway.

    Exclusive APIGW, which connects to the APIGW gateway.

    IAM authentication, which means access using a token.

    Description

    A description of the application to be created.

  3. Click OK.

    After the app is created, its name and ID are displayed in the app list.

  4. Click an app name, and view the AppKey and AppSecret on the displayed app details page.
    Figure 1 App details page

Authorizing an API to an App

  1. Log in to the DGC console, select a DGC instance, and click Access.

    On the displayed page, click the Workspaces tab. In the workspace list, locate the required workspace.

  1. Click Data Lake Mall of the corresponding workspace.

    Navigate to the Data Lake Mall console.

  1. Authorize an API to an app in either of the following ways:
    Giving API authorization:
    1. Choose API Development > APIs.
    2. Locate the row that contains the API to be bound, and click View.

      On the displayed page, click Authorize.

    3. Set an expiry time, select an application, and click OK.

    Applying for authorization:

    1. Choose API Calls > Service Catalogs.
    2. Click the name of the API you want to bind to an app. The API information page is displayed.
    3. On the displayed page, click Permission Application.
    4. Set an expiry, select an application, and click OK.
    5. After the application is submitted, the authorization takes effect only after it is approved in the review center.
  2. After the authorization is complete, view the bound APIs on the application details page.
    • In the API list, if you no longer access an API through the app, click Unbind in the Operation column.
    • To test an API to which the application is bound, choose More > Debug in the Operation column
    • To extend the authorization period for a bound API, click Renew.

Calling an API

DLM provides the application authentication mode for calling an API.

When the application authentication is used, the SDK is required for access.

Java, Go, Python, JavaScript, C#, PHP, C++, C, and Android SDKs are available.

For details on how to use the application authentication method, see the DLM SDK Reference.