部署后端API
功能介绍
在某个实例中部署后端API。
URI
POST /v1/{project_id}/apic/instances/{instance_id}/livedata-apis/deploy
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。 |
|
instance_id |
是 |
String |
实例ID |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
ld_api_id |
否 |
String |
部署的后端API编号 |
|
deploy_front_api |
否 |
Boolean |
是否自动发布API
|
|
auth_type |
否 |
String |
认证方式
|
|
authorizer_id |
否 |
String |
自定义认证编号。 认证方式auth_type = AUTHORIZER时必填 |
|
group_id |
否 |
String |
部署的前端API分组编号 |
|
env_id |
否 |
String |
部署的环境编号 |
|
protocol |
否 |
String |
请求协议 |
|
backend_timeout |
否 |
Integer |
超时时间 |
|
path |
否 |
String |
请求路径 |
|
method |
否 |
String |
请求方式 |
|
cors |
否 |
Boolean |
是否支持跨域
|
|
roma_app_id |
否 |
String |
部署到前端的api归属的应用编号,与后端归属的应用编号保持一致 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
id |
String |
部署的编号 |
|
ld_api_id |
String |
部署的后端API编号 |
|
group_id |
String |
部署的前端API分组编号 |
|
env_id |
String |
部署的环境编号 |
|
api_id |
String |
部署的前端API编号 |
|
deploy_time |
String |
部署时间 |
|
api_definition |
LdApiInfo object |
自定义后端API详情 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
name |
String |
后端API名称。 支持汉字、英文、数字、中划线、下划线、点、斜杠、中英文格式下的小括号和冒号、中文格式下的顿号,且只能以英文、汉字和数字开头。 |
|
path |
String |
后端API请求路径。 支持英文、数字、中划线、下划线、点等,且以斜杠(/)开头。 更新后端API时,status=4为后端API的已部署状态,该状态下后端API请求路径不能修改。 |
|
method |
String |
后端API请求方法。 支持GET、PUT、POST、DELETE 更新后端API时,status=4为后端API的已部署状态,该状态下后端API请求方法不能修改。 |
|
description |
String |
后端API描述。 不支持<,>字符 |
|
version |
String |
后端API版本 支持英文,数字,下划线,中划线,点。 |
|
content_type |
String |
后端API返回类型 |
|
api_signature_id |
String |
后端API为签名认证时绑定的签名密钥编号 |
|
roma_app_id |
String |
后端API归属的集成应用编号 更新后端API时,status=4为后端API的已部署状态,该状态下后端API归属的集成应用编号不能修改。 |
|
return_format |
Boolean |
API响应信息是否格式化 true: 对响应信息进行格式化 false:对响应信息格式化不进行格式化 |
|
parameters |
Array of LdApiParameter objects |
后端API的请求参数列表 |
|
id |
String |
后端API编号 |
|
instance |
String |
后端API所属实例编号 |
|
type |
String |
后端API类型:
|
|
status |
Integer |
后端API状态:
|
|
created_time |
String |
后端API创建时间 |
|
modified_time |
String |
后端API修改时间 |
|
scripts |
Array of LdApiScript objects |
后端API脚本信息 |
|
roma_app_name |
String |
后端API归属的集成应用名称 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
name |
String |
参数名称:
|
|
in |
String |
该参数在调用API时候所放的位置:
|
|
default |
String |
参数默认值 |
|
description |
String |
参数描述 不支持<,>字符 |
|
required |
Boolean |
参数是否必须。true:必须,false:不必须 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
ds_id |
String |
数据源编号,当api_type = data时,必选 |
|
ds_name |
String |
数据源名称 |
|
ds_type |
String |
数据源类型:
|
|
type |
String |
脚本类型
|
|
object_name |
String |
返回对象。 |
|
content |
String |
API脚本内容 请对脚本进行base64编码 |
|
enable_result_paging |
Boolean |
数据脚本是否结果分页,当api_type = data时有效 |
|
enable_preparestatement |
Boolean |
数据脚本是否预编译,当api_type = data时有效 |
|
created_time |
String |
后端API脚本创建时间 |
|
modified_time |
String |
后端API脚本修改时间 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码: 401
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码: 403
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码: 404
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码: 409
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
状态码: 500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
错误码 |
|
error_msg |
String |
错误描述 |
请求示例
{
"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"
}
响应示例
状态码: 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"
}
状态码: 400
Bad Request
{
"error_code" : "APIG.2011",
"error_msg" : "Invalid parameter value,parameterName:auth_type. Please refer to the support documentation"
}
状态码: 401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
}
状态码: 403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
}
状态码: 404
Not Found
{
"error_code" : "APIG.3084",
"error_msg" : "The livedata API does not exist, id: bd42841c20184da6bbf457c6d8a06e37"
}
状态码: 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"
}
状态码: 500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
404 |
Not Found |
|
409 |
Conflict |
|
500 |
Internal Server Error |
错误码
请参见错误码。