Creates a service.
Operation description
You can call this operation to create multiple services at a time.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- For mandatory resource types, indicate with a prefix of * .
- If the permissions cannot be granted at the resource level,
All Resourcesis used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| apig:CreateService | none | *Service acs:apig:{#regionId}:{#accountId}:service/* |
| none |
Request syntax
POST /v1/services HTTP/1.1
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| body | object | No | The request body. | |
| gatewayId | string | No | The gateway instance ID. | gw-cq7l5s5lhtg*** |
| sourceType | string | No | The service source. Valid values:
Enumerated values:
| MSE_NACOS |
| serviceConfigs | array<object> | No | The list of service configurations. | |
| object | No | The service configurations. | ||
| name | string | No | The service name. | user-service |
| namespace | string | No | The service namespace. This parameter is required when sourceType is set to K8S or MSE_NACOS.
| PUBLIC |
| groupName | string | No | The service group name. This parameter is required if sourceType is set to MSE_NACOS. | DEFAULT_GROUP |
| addresses | array | No | The list of domain names or fixed addresses. | |
| string | No | The domain name or fixed address. | dev.com:8080 | |
| qualifier | string | No | The function version or alias. | LATEST |
| aiServiceConfig | AiServiceConfig | No | The AI service configurations. | |
| dnsServers | array | No | The list of DNS service addresses. | |
| string | No | The DNS service address. | 100.100.2.136:53 | |
| resourceGroupId | string | No | The resource group ID. | rg-xxx |
Response parameters
Examples
Sample success responses
JSONformat
{
"requestId": "C67DED2B-F19B-5BEC-88C1-D6EB854CD0D4",
"code": "Ok",
"message": "success",
"data": {
"serviceIds": [
"svc-crbgq0dlhtgrdb***"
]
}
}Error codes
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|---|---|
| 2025-06-26 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
| 2025-02-27 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
