Deploying a Backend API
Function
This API is used to deploy a backend API in an instance.
URI
POST /v1/{project_id}/apic/instances/{instance_id}/livedata-apis/deploy
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference. |
|
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
ld_api_id |
No |
String |
ID of the deployed backend API. |
|
deploy_front_api |
No |
Boolean |
Whether the backend is automatically published as a frontend API.
Default: true |
|
auth_type |
No |
String |
Authentication mode.
Default: APP |
|
authorizer_id |
No |
String |
Custom authorizer ID. This parameter is mandatory only if the auth_type is set to AUTHORIZER. |
|
group_id |
No |
String |
ID of the deployed frontend API group. |
|
env_id |
No |
String |
ID of the deployed environment. |
|
protocol |
No |
String |
Request protocol. Default: HTTPS |
|
backend_timeout |
No |
Integer |
Timeout. |
|
path |
No |
String |
Request path. |
|
method |
No |
String |
Request method. |
|
cors |
No |
Boolean |
Whether CORS is supported.
Default: false |
|
roma_app_id |
No |
String |
ID of the application to which the API deployed on the frontend belongs, which must be the same as the ID of the application to which the backend belongs. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Deployment ID. |
|
ld_api_id |
String |
ID of the deployed backend API. |
|
group_id |
String |
ID of the deployed frontend API group. |
|
env_id |
String |
ID of the deployed environment. |
|
api_id |
String |
ID of the deployed frontend API. |
|
deploy_time |
String |
Deployment time. |
|
api_definition |
LdApiInfo object |
Custom backend API details. |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Backend API name. The regular expression is ([a-zA-Z]|[\u4e00-\u9fa5])([a-zA-Z0-9_]|[\u4e00-\u9fa5]){2,63}. Minimum: 3 Maximum: 100 |
|
path |
String |
Backend API request path. The regular expression is (/)|((/[.a-zA-Z0-9_-]+)+/?), and the maximum length is 256 characters. Minimum: 2 Maximum: 256 |
|
method |
String |
Backend API request method, which can be GET, PUT, POST, or DELETE. |
|
description |
String |
Backend API description, which cannot contain < and >. Minimum: 0 Maximum: 1000 |
|
version |
String |
Backend API version, which contains 2 to 16 characters excluding < and >. Minimum: 2 Maximum: 64 |
|
content_type |
String |
Type of the returned backend API. Default: json |
|
api_signature_id |
String |
ID of the signature key bound to the API for signature authentication Minimum: 1 Maximum: 64 |
|
roma_app_id |
String |
ID of the integration application to which the backend API belongs. Minimum: 1 Maximum: 65 |
|
return_format |
Boolean |
Indicates whether to format the API response information. true: The response information is formatted. false: The response information is not formatted. Default: false |
|
parameters |
Array of LdApiParameter objects |
Request parameter list of the backend API. |
|
id |
String |
Backend API ID. |
|
instance |
String |
Backend API owner. |
|
type |
String |
Backend API type. |
|
status |
Integer |
Backend API status. |
|
created_time |
String |
Time when the backend API was created. |
|
modified_time |
String |
Time when the backend API was modified. |
|
scripts |
Array of LdApiScript objects |
Backend API script information. |
|
roma_app_name |
String |
Name of the integration application to which the backend API belongs. |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Parameter name.
Minimum: 1 Maximum: 32 |
|
in |
String |
Parameter location. |
|
default |
String |
Default value. Maximum: 4000 |
|
description |
String |
Parameter description, which cannot contain < and >. Minimum: 0 Maximum: 255 |
|
required |
Boolean |
Whether the parameter is mandatory. true: The parameter is mandatory. false: The parameter is optional. Default: false |
|
Parameter |
Type |
Description |
|---|---|---|
|
ds_id |
String |
Data source ID. This parameter is mandatory only if api_type is set to data. |
|
ds_name |
String |
Data source name. |
|
ds_type |
String |
Data source type.
|
|
type |
String |
Script type.
|
|
object_name |
String |
Returned object. This parameter is mandatory only if api_type is set to data. Minimum: 1 Maximum: 32 |
|
content |
String |
API script content. Perform Base64 encoding on the script. Minimum: 1 Maximum: 100000 |
|
enable_result_paging |
Boolean |
Indicates whether to display the data script result on multiple pages. This parameter is mandatory only if api_type is set to data. Default: false |
|
enable_preparestatement |
Boolean |
Indicates whether to pre-compile the data script. This parameter is mandatory only if api_type is set to data. Default: false |
|
created_time |
String |
Time when the backend API script was created. |
|
modified_time |
String |
Time when the backend API script was modified. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 409
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error description. |
Example Requests
{
"ld_api_id" : "bd42841c20184da6bbf457c6d8a06e37",
"auth_type" : "APP",
"backend_timeout" : 5000,
"cors" : false,
"deploy_front_api" : true,
"env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
"group_id" : "01ce7564a2544713b80c7c08eb85f5d0",
"method" : "GET",
"path" : "/test/function",
"protocol" : "HTTPS",
"roma_app_id" : "98df09fb-d459-4cbf-83a7-2b55ca6f3d5d"
}
Example Responses
Status code: 200
OK
{
"api_definition" : {
"content_type" : "json",
"created_time" : "2020-09-18T09:25:59Z",
"description" : "",
"id" : "bd42841c20184da6bbf457c6d8a06e37",
"instance" : "f0fa1789-3b76-433b-a787-9892951c620e",
"method" : "GET",
"modified_time" : "2020-09-19T06:29:35Z",
"name" : "livedata_api_demo",
"parameters" : [ ],
"path" : "/test/function",
"return_format" : false,
"roma_app_id" : "98df09fb-d459-4cbf-83a7-2b55ca6f3d5d",
"roma_app_name" : "app-demo",
"scripts" : [ {
"type" : "SQL",
"object_name" : "fun",
"content" : "ZnVuY3Rpb24gZXhlY3V0ZShkYXRhKSB7CiAgICByZXR1cm4gIkhlbGxvIHdvcmxkISIKfQ==",
"created_time" : "2020-09-19T06:29:35Z",
"modified_time" : "2020-09-19T06:29:35Z"
} ],
"status" : 4,
"type" : "function",
"version" : "1.0.1"
},
"api_id" : "1d0432f1a82a49d08b9308ae7bd96ca6",
"deploy_time" : "2020-09-19T06:58:13Z",
"env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
"group_id" : "01ce7564a2544713b80c7c08eb85f5d0",
"id" : "5e19590f54444d8a9b8fe698ce26e9fe",
"ld_api_id" : "bd42841c20184da6bbf457c6d8a06e37"
}
Status code: 400
Bad Request
{
"error_code" : "APIG.2011",
"error_msg" : "Invalid parameter value,parameterName:auth_type. Please refer to the support documentation"
}
Status code: 401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
Status code: 403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
}
Status code: 404
Not Found
{
"error_code" : "APIG.3084",
"error_msg" : "The livedata API does not exist, id: bd42841c20184da6bbf457c6d8a06e37"
}
Status code: 409
Conflict
{
"error_code" : "APIG.3479",
"error_msg" : "the roma app used for deploy must be the same as the roma app of the ld api"
}
Status code: 500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
404 |
Not Found |
|
409 |
Conflict |
|
500 |
Internal Server Error |
Error Codes
See Error Codes.
Last Article: Querying the Deployment History of a Backend API
Next Article: Testing a Backend API
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.