Updated on 2025-04-28 GMT+08:00

Huawei Cloud Astro Zero API Datasets

You can call the API of Huawei Cloud Astro Zero to obtain data.

Prerequisites

  • The data source to be connected has been created. For details, see Huawei Cloud Astro Zero Data Sources.
  • The converter used by datasets has been created. For details about how to create a converter, see Creating a Converter.

    Huawei Cloud Astro Zero preset converters to transform API data into a two-dimensional structure. If you use these preset converters, you can skip this step. In this example, create the converter shown in Figure 1 in advance.

    Figure 1 Converter

Creating a Dataset

  1. Log in to Huawei Cloud Astro Canvas by referring to Logging In to Huawei Cloud Astro Canvas.
  2. Choose Data Center from the main menu.
  3. Choose Datasets > All in the navigation pane.
  4. On the Dataset Management page, click Create.
  5. Set the dataset name, specify the data type, data source, and folder, and click Save.

    Figure 2 Creating a Huawei Cloud Astro Zero API dataset
    • Dataset Name: A dataset is identified by its name. The name contains 1 to 60 characters, including letters, digits, and underscores (_).
    • Data Type: Select AstroZeroAPI.
    • Data Source: Select the data source created in Huawei Cloud Astro Zero Data Sources.
    • Folder: Set the folder for storing the dataset. You can select the folder created in (Optional) Creating a Folder or click New Folder.
    • Owner: Creator of the dataset.
    • Description: Description of the new dataset, which is usually the function of the dataset.

  6. Configure dataset parameters.

    Figure 3 Configuring a dataset
    • Application: Application to which the custom API to be called belongs.
    • API URL: API to be called. The options in the drop-down list are API tags. If an API tag is in Chinese, the API tag is displayed in Chinese. If an API tag is not defined, the operation name of the API is displayed.
    • Request Type: API Request type. The system automatically sets this parameter.
    • Parameters: API input parameter. When there are input parameters, they will be displayed automatically. This parameter is not involved in this example.

      If there is an input parameter, you can click Variable Configuration next to Parameters to set a default value for the variable.

      Figure 4 Setting default values for variables
    • Test API: API testing. After you click Test API, the output is displayed in the Sample Packet area.
    • Sample Packet: Sample response packet of the API. The metadata structure of the dataset is determined by the data structure of the sample response packet after the packet is processed by the transformer.
      {"resCode":"0","resMsg":"Success","result":{"data":[{"name":"City A","value":806},{"name":"City B","value":421},{"name":"City C","value":332},{"name":"City D","value":165},{"name":"City E","value":729}]}}

      After entering the sample packet, click Format to format the sample packet.

    • Converter: Click Create to create a converter or select the converter created in Creating a Converter to convert data.
    • Data Preview: Click the preview button to display the sample packet processed by the converter.

  7. Click Save. The dataset is created.

Using the Dataset in Widgets

  1. Return to the Projects page.
  2. Go to the development page and drag required widgets (for example, basic bar chart) to the canvas.

    Figure 5 Dragging the desired widget to the canvas

  3. Select the widget and click .
  4. Select Dataset from the Data Type drop-down list and select the dataset created in section Creating a Dataset.
  5. Set global variables.

    Global variables can be regarded as parameter variables and used to control parameter transfer between widgets for interactions such as diagram and table association and field customization.

  6. In the widget preview, select the form fields to be displayed by dragging them from the left column to the right column, and click Save.

    Figure 6 Dragging a field to the axis
    • Form field: Data recorded in section Creating a Dataset.
    • Configuration: Drag the required fields from the form field area to the X-axis data, Y-axis data, and series.
    • Refresh cycle: Interval for obtaining data from Huawei Cloud Astro Zero. Default is 0, meaning the data is obtained only once.
    • Data sharing: When enabled, multiple widgets calling the same bridge URL request will share the result data.

  7. Select the bar chart widget, click , and set the title to "January Rainfall by City (mm)".

    Figure 7 Setting the chart title

  8. Click in the upper part of the page to save the settings.
  9. Click to preview.