Calling APIs
Preparation
To call an API, do as follows:
- Obtain an API.
- 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.
- 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
- 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.
- Click Data Lake Mall of the corresponding workspace.
Navigate to the Data Lake Mall console.
- 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.
- Click OK.
After the app is created, its name and ID are displayed in the app list.
- 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
- 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.
- Click Data Lake Mall of the corresponding workspace.
Navigate to the Data Lake Mall console.
- Authorize an API to an app in either of the following ways: Giving API authorization:
- Choose API Development > APIs.
- Locate the row that contains the API to be bound, and click View.
On the displayed page, click Authorize.
- Set an expiry time, select an application, and click OK.
Applying for authorization:
- Choose > .
- Click the name of the API you want to bind to an app. The API information page is displayed.
- On the displayed page, click Permission Application.
- Set an expiry, select an application, and click OK.
- After the application is submitted, the authorization takes effect only after it is approved in the review center.
- 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.
Last Article: Deleting APIs
Next Article: Operating APIs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.