可以创建工作空间。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求语法
POST /api/workspaces
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
name | string | 否 | 工作空间名称 | Demo |
workspaceTemplate | string | 是 | 技术栈 | all-in-one |
codeUrl | string | 是 | 代码来源URL(当前仅支持云效 Codeup 来源) | git@codeup.aliyun.com:demo/Codeup-Demo.git |
codeVersion | string | 是 | 代码版本,支持 commitSHA、分支、标签 | master |
filePath | string | 否 | 打开空间默认打开的文件相对路径 | src/Test.java |
reuse | boolean | 否 | 工作空间复用标识,按照"用户+技术栈+代码地址+版本"进行复用
| false |
resourceIdentifier | string | 否 | 资源标识,提供给非标代码源作为空间复用的唯一标识 | acs:fc:cn-shenzhen:XXX:services/demo.LATEST/functions/demo |
requestFrom | string | 否 | 请求来源(用于统计,云产品集成时需要传入) | fc |
返回参数
示例
正常返回示例
JSON
格式
{
"workspace": {
"id": "6ed82817-ab75-4563-865d-81e60dxxxxxx",
"name": "Demo",
"status": "SUCCESS",
"template": "all-in-one",
"creator": "1470227819xxxxxx",
"createTime": "1628564442000"
},
"requestId": "F7B85D1B-D1C2-140F-A039-341859F130B9",
"success": true,
"errorCode": "WorkspaceQuotaExceeded",
"errorMessage": "The maximum number of workspace per user is exceeded."
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidResource.NotFound | No resource is found. You cannot create the workspace. Please try again later. | 没有资源,无法创建工作空间,请稍后尝试 |
400 | InvalidCluster.NotFound | No cluster is available to generate the workspace. | 没有可用的集群,无法创建工作空间 |
400 | InvalidCodeUrl.NotSupportSVN | The parameter codeUrl is invalid. SVN is not supported. | 参数错误,不支持svn |
400 | InvalidWorkspaceTemplate.NotFound | The parameter workspaceTemplate is not found. | 技术栈(即空间模板)不存在 |
403 | WorkspaceQuotaExceeded | The maximum number of workspace per user is exceeded. | 单用户的工作空间数量已达到配额 |
访问错误中心查看更多错误码。