文档首页> 推荐系统 RES> API参考> API> 场景> 创建自定义场景
更新时间:2022-05-13 GMT+08:00
分享

创建自定义场景

功能介绍

在指定工作空间下面创建自定义场景。

调试

您可以在API Explorer中调试该接口。

URI

POST /v2.0/{project_id}/workspaces/{workspace_id}/scenes

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目id,获取方式请参见获取项目ID

workspace_id

String

工作空间id。

表2 Query参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户token,获取方式请参见获取用户Token

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

Content-Type

String

内容类型,取值为application/json。

表4 请求Body参数

参数

是否必选

参数类型

描述

category

String

场景类型:

  • customize,自定义推荐

datasource_id

String

数据源id。

ds_config

ds_config object

数据源配置。

scene_name

String

场景名称,1-64位的字母、数字、下划线、中划线组合。

最小长度:1

最大长度:64

specs_config

SpecsConfig object

计算规格。

type

String

场景类型:

  • UI,基于用户推荐物品

  • UU,基于用户推荐用户

  • II,基于物品推荐物品

  • IU,基于物品推荐用户

service_type

String

服务类型:

  • rank,排序服务

  • rec,推荐服务

表5 ds_config

参数

是否必选

参数类型

描述

time_interval

Integer

数据选择(天)。

category_type

String

物品类别。

表6 SpecsConfig

参数

是否必选

参数类型

描述

offline

String

离线计算规格。

nearline

String

实时计算规格。

rank

String

深度学习计算规格。

online_tps

Integer

在线服务最大并发数。

响应参数

状态码: 200

表7 响应Body参数

参数

参数类型

描述

is_success

Boolean

是否成功。

message

String

返回消息(请求成功时,不返回此字段)。

scene

scene object

场景信息。

error_code

String

错误码(请求成功时,不返回此字段)。

表8 scene

参数

参数类型

描述

category

String

类型。

type

String

场景类型。

scene_name

String

场景名称。

scene_id

String

场景id。

datasource_id

String

数据源id。

status

String

状态。

created_at

Integer

创建时间。

update_at

Integer

更新时间。

workspace_id

String

工作空间id。

service_type

String

服务类型。

请求示例

创建场景

/v2.0/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/workspaces/testuuidxxxxxxxxxxxxxxxxxxxxxxxx/scenes

{
  "scene_name" : "jby-test-0227-4",
  "category" : "customize",
  "type" : "UI",
  "service_type" : "rank",
  "datasource_id" : "6a3475a7dd11492e8d14f73a3719333b",
  "ds_config" : {
    "time_interval" : 30
  },
  "specs_config" : {
    "offline" : "4CU",
    "nearline" : "2CU",
    "rank" : "8CU",
    "online_tps" : 10
  }
}

响应示例

状态码: 200

OK

{
  "scene" : {
    "type" : "UI",
    "service_type" : "rank",
    "scene_name" : "jby-test-0227-4",
    "category" : "customize",
    "scene_id" : "f715e1c61f1f40489b2e4594650fffd8",
    "datasource_id" : "6a3475a7dd11492e8d14f73a3719333b",
    "status" : "INITIALIZED",
    "created_at" : 1584628346333,
    "update_at" : 0,
    "workspace_id" : "68887f2a855f45e7ab4850ecc7ca28c2"
  },
  "is_success" : true
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品