このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Creating and Opening a Data API

Updated on 2023-08-28 GMT+08:00

Overview

Through the data API, the parking space status data in the parking lot management system is opened to third-party applications so that vehicle owners and transportation departments can learn about the parking space status.

Procedure

  1. Create a backend.
    1. In the navigation pane on the left, choose API Connect > Custom Backends. On the Backends tab, click Create Backend.
    2. Set backend parameters and click Create.
      Table 1 Backend configuration

      Parameter

      Description

      Name

      Backend name.

      Integration Application

      Select the integration application created in Registering a Device on ROMA Connect.

      Backend Request Method

      Request method of the backend. Set this parameter to GET here.

      Backend Request Path

      Enter the request path of the backend in the /serviceName/interfaceName format.

      Backend Security Authentication

      Security authentication mode of the backend. Set this parameter to None here because the API to open and the backend service are in the same instance in this practice.

      Description

      Enter a brief description of the backend.

      Advanced Settings

      Retain the default settings in the Advanced Settings area.

      After the backend is created, the online IDE of the backend is automatically displayed. The backend type is data backend by default.

  2. Configure and deploy the data backend.
    1. In the upper left corner, choose New Data Backend > Add Data Source.
    2. On the Add Data Source page displayed, configure data source information and click Add.
      Table 2 Data source configuration

      Parameter

      Description

      Select Data Source

      Select the MySQL data source connected in Creating an MQS-to-Database Integration Task.

      Select Statement Type

      Select the type of the statement to be executed. In this example, select SQL.

      Advanced Settings

      Retain the default settings in the Advanced Settings area.

    3. After adding a data source, select the data source on the left of the online IDE and add the following statement to the statement editing box on the right to obtain the number of vacant parking spaces from the database.
      The following statement assumes that the name of the data table that stores parking space information and parking space status information is ParkingData, and the parking space status field in the table is Status in the MySQL database.
      SELECT COUNT(Status) AS FreeNo FROM ParkingData WHERE Status="0";
    4. Click Save in the upper right corner of the page to save the backend configuration.
    5. Click Test in the upper right corner of the page, and then click Test in the Test Parameters pane below.

      In the Execution Result column, check whether the following JSON data is returned. xxx indicates the number of vacant parking spaces.

      {"default":[{"FreeNo":xxx}]}
    6. After the backend is tested, click Deploy in the upper right corner of the page. In the dialog box displayed, click Yes to deploy the data backend.
  3. Publish the data API.
    1. After the backend deployment is complete, click Publish in the upper right corner of the page.
    2. On the page displayed, set the parameters and click Publish to create a frontend API for the backend and publish the API in an environment.
      After the API is published, the API details page is displayed.
      Table 3 Parameters for publishing a backend

      Parameter

      Description

      Group

      Select an API group for the frontend API. If no API group is available, click Create API Group on the right to create one.

      Environment

      Select the default environment RELEASE.

      Frontend Security Authentication

      Select the authentication mode of the API. The App authentication mode is recommended.

      • App: ROMA Connect authenticates API requests. When calling an API, a user gets authenticated using the key and secret of an integration application.
      • IAM: IAM authenticates API requests. When calling an API, a user gets authenticated using a token or an AK/SK pair.
      • Custom: The custom function API is used for authenticating API requests.
      • None: Authentication is not required for API requests.

      Custom Authorizer

      Mandatory for Frontend Security Authentication set to Custom.

      Select a frontend custom authorizer you have created.

      Frontend Request Protocol

      Select the request protocol used by the frontend API. The value can be HTTPS, HTTP, or HTTP&HTTPS. HTTPS is recommended for transmitting important or sensitive data.

      Timeout (ms)

      Enter the timeout interval of a backend service request. The default value is 60000.

      Retries

      Number of retries after ROMA Connect fails to call the backend service.

      • If the value is -1, this parameter is disabled.
      • If the value ranges from 0 to 10, this parameter is enabled, and retries are performed based on the configured value.

      Advanced Settings

      Frontend Request Method

      Select the request method of the frontend API. ANY indicates that the API can be accessed using any request method.

      Frontend Request Path

      Enter the request path of the frontend API, for example, /getUserInfo/userId.

      The request path is case sensitive.

      CORS

      Whether the API supports cross-origin resource sharing (CORS). In this example, disable this parameter.

  4. Bind an independent domain name to the data API.
    1. On the API details page displayed after you publish the API, choose Group Information and click Bind Independent Domain Name in the Independent Domain Names area.
    2. In the displayed dialog box, enter the domain name and click OK.
      Table 4 Independent domain name configuration

      Parameter

      Description

      Domain Name

      Enter the domain name to be bound.

      Minimum TLS Version

      The minimum TLS version that can be used to access the domain name.

      HTTP-to-HTTPS Auto Redirection

      Whether to support HTTP-to-HTTPS redirection.

      Redirection takes effect only when the API request protocol is HTTPS or HTTP&HTTPS and an SSL certificate has been bound to the independent domain name.

      NOTE:

      Redirection is only suitable for GET and HEAD requests. Redirecting other requests may cause data loss due to browser restrictions.

    3. (Optional) For HTTPS-compatible data APIs, bind an SSL certificate to their independent domain name.
      1. Click Select SSL Certificate on the right of the independent domain name.
      2. Select an SSL certificate and click OK.

        If none is available, click Create SSL Certificate to create one.

  5. Switch to the APIs tab and obtain the API request method and URL for external applications to call the API.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback