订阅Offer
功能介绍
订阅Offer。
URI
POST /v1/{project_id}/eds/instances/{instance_id}/connectors/{connector_id}/subscriptions
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
用户Token,通过调用IAM服务“获取用户Token”接口获取(响应消息头中X-Subject-Token的值)。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
asset_id |
是 |
String |
订阅资产ID。 |
|
subscription_reason |
是 |
String |
订阅理由。 只能包含英文字母,数字,下划线,中文及-,并且只能以中文和英文开头,最大长度不超过255。 最小长度:1 最大长度:255 |
|
use_control_policies |
是 |
Array of UseControlPoliciesInner objects |
合约使用控制策略列表。 |
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
action |
是 |
String |
执行动作过滤:
枚举值:
|
|
when |
是 |
TimeInterval object |
限制使用时间。 |
|
how_many |
否 |
Integer |
限制使用次数。 参数校验规则:最小值1,最大值10000。 |
|
who |
是 |
Array of strings |
限制用户/团队列表。(目前不支持多个用户或者团队) |
|
user_type |
否 |
String |
限制用户类型。(团队订阅时who和user_type必填)
枚举值:
|
|
application |
是 |
Array of strings |
限制应用列表。 |
|
additional_attributes |
否 |
DatabaseAttributes object |
策略的扩展属性。 |
响应参数
状态码: 200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
offer_id |
String |
Offer ID。 |
|
offer_name |
String |
Offer名称。 |
|
subscription_id |
String |
订阅返回ID。 |
|
subscription_reason |
String |
订阅理由。 |
|
status |
String |
订阅状态:
枚举值:
|
|
create_time |
String |
创建时间。 |
|
creator |
String |
创建人。 |
状态码: 400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
data |
Object |
返回数据。 |
|
total |
Long |
总数。 |
|
error_code |
String |
错误码。 |
|
error_msg |
String |
错误描述。 |
状态码: 500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
data |
Object |
返回数据。 |
|
total |
Long |
总数。 |
|
error_code |
String |
错误码。 |
|
error_msg |
String |
错误描述。 |
请求示例
订阅Offer。
POST https://{endpoint}/v1/{project_id}/eds/instances/{instance_id}/connectors/{connector_id}/subscriptions
{
"asset_id" : "834ed288-d8e1-4b70-9ed1-************",
"subscription_reason" : "订阅",
"use_control_policie" : [ {
"action" : "VIEW",
"how_many" : null,
"where" : {
"device_ip" : [ ],
"device_mac" : [ ]
},
"who" : [ ],
"user_type" : null,
"application" : [ "dae4237f-9880-4fb9-a618-************" ],
"additional_attributes" : { }
} ]
}
响应示例
状态码: 200
OK
- 订阅Offer返回体。
{ "offer_id" : "834ed288-d8e1-4b70-9ed1-6744329955a8", "offer_name" : "上架Offer测试023", "subscription_id" : "8d9dec24-3bb9-47c2-ac6f-0a3d9e308d5a", "subscription_reason" : "同意一下", "status" : "WAIT_TO_APPROVE", "create_time" : "2023-12-07T09:11:36Z", "creator" : "0574abfba400d2a91f5ec01111a89fcf" }
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
500 |
Internal Server Error |
错误码
请参见错误码。