An API group is used to manage APIs. An API group can be a specific system name, a module name, or an abstract identifier.
Currently, Mobile Gateway supports the following types of API groups:
HTTP: A group for RESTful HTTP services. These services support cross-virtual private cloud (VPC) service invocation.
MPC: A group for services based on the mPaaS proprietary RPC framework. These services support cross-VPC service invocation.
Create a group
Before you create an MPC API group, you must register the API service with the specified registry. For more information, see Register an MPC API service.
Log on to the mPaaS console and navigate to the Mobile Gateway page from the navigation pane on the left. You can then create different types of API groups as needed.
Create an HTTP API group
To create an HTTP API group, complete the following steps:
Click the API Group tab to open the API group list page.
Click Create API Group. In the dialog box that appears, configure the following parameters.
Group Type: Select HTTP.
API Group: Required. Enter the English name of the backend service.
Cross-VPC HTTP: Specifies whether to allow cross-VPC service invocation. If you enable this option, you can invoke services across different VPCs. This feature is designed for scenarios where the Mobile Gateway Service (MGS) and your service are deployed in different VPCs, and you need to use MGS to invoke backend services across these VPCs.
NoteThe cross-VPC HTTP feature is available only in the Shanghai Finance region.
To enable the cross-VPC HTTP invocation feature, configure the following parameters:
Support HTTPS: MGS can forward HTTPS requests using Server Load Balancer (SLB) HTTPS listeners. This provides data encryption in transit. By default, this feature is enabled. If you do not need to use an HTTPS domain name, select No.
HTTPS Domain Name: This parameter is required only if you enable HTTPS support. The value must be the domain name of the certificate that is attached to the SLB instance.
VPC ID: The ID of the VPC where the Elastic Compute Service (ECS) instance for the service deployment is located, or the VPC to which the SLB instance belongs.
Instance IP or Address: The primary private IP address of the ECS instance for the service deployment, or the IP address of the SLB instance.
Port Number: The service port number.
ImportantMGS does not support self-signed certificates. When you use cross-VPC HTTPS, you must use a domain name with a CA-signed certificate. Otherwise, domain name resolution fails.
If you use only an ECS instance to configure the backend service, open the required ports in the security group of the ECS instance to prevent requests from being blocked by security policies. To obtain the required port and IP address information, submit a ticket to contact the helpdesk.
Cross-VPC access is supported only within the same region. For example, a service deployed in the Hangzhou region cannot invoke a service in the Shanghai region. In addition, finance and non-finance zones within the same city are considered different regions. For example, the Hangzhou Finance region and the Hangzhou non-finance region are two different regions.
If you use both SLB and ECS instances to configure the backend service, ensure that the SLB and ECS instances are in the same VPC.
Service Endpoint: The HTTP or HTTPS URL of the backend service. This parameter is required if the cross-VPC HTTP feature is disabled.
Timeout: Optional. The timeout for requests sent to the backend service. Unit: milliseconds. The default value is 3000 ms.
After you configure the parameters, click OK to create the group.
Create an MPC API group
To create an MPC API group, complete the following steps:
Click the API Group tab to open the API group list page.
Click Create API Group. In the dialog box that appears, configure the following parameters.
Group Type: Select MPC.
API Group: Required. Enter the English name of the backend service. The API group name must be the same as the application name of the registered API service.
Timeout: Optional. The timeout for requests sent to the backend service. Unit: milliseconds. The default value is 3000 ms.
Project Name: The project name of the current environment is used by default.
After you configure the parameters, click OK to create the group.
Configuration groups
Configure the API group based on its type.
Configure an HTTP API group
In the API group list, find the HTTP API group that you want to configure. In the Operations column, click Details to open the details page. In the upper-right corner of the details page, click Modify. You can configure the following parameters for an HTTP API group:
Service Endpoint: The URL of the backend HTTP service.
Timeout: Unit: milliseconds. The default value is 3000 ms.
Verify Signature: Enable this option if the backend service needs to authenticate the caller's identity. For more information about authentication, see Backend signature verification. After you enable signature verification, configure the following parameters:
Signature Algorithm: The algorithm used to generate the signature. mPaaS Mobile Gateway on the public cloud supports the MD5, RSA, SM2, and SM3 algorithms.
Key: The key used for backend signature verification. You can customize this key.
Key Content: The value of the key used for backend signature verification.
If the signature algorithm is MD5, you can customize the key content.
If the signature algorithm is RSA, the value is the public key of Mobile Gateway.
If the signature algorithm is SM2 or SM3, you can customize the key content. For more information about how to generate a key, see Key generation methods.
Configure an MPC group
In the API group list, find the MPC API group that you want to configure. In the Operations column, click Details to open the details page. In the upper-right corner of the details page, click Modify. You can configure the following parameters for an MPC API group:
Project Name: The project name of the tenant to which the group belongs. This value is automatically retrieved and cannot be modified.
Timeout: Unit: milliseconds. The default value is 3000 ms.