# 批量创建资源
# 调用方式: POST
# 接口地址:
https://api.freelog.com/v2/resources/createBatch
1
# body传入参数说明:
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
resourceTypeCode | 必选 | string | 资源类型编号,当resourceTypeName不为空时,为父资源类型编号 |
resourceTypeName | 可选 | string | 资源类型名称 |
createResourceObjects | 必选 | object[] | 创建的资源集合 |
**name | 必选 | string | 资源名称,此处无需加上用户名 |
**resourceTitle | 可选 | string | 资源标题 |
**policies | 可选 | object[] | 资源策略信息 |
****policyName | 必选 | string | 策略名称(数组内唯一) |
****policyText | 必选 | string | 策略文本,encodeURIComponent编码 |
****status | 可选 | int | 1:上线 0:下线 |
**coverImages | 可选 | string[] | 资源封面图,最多10张 |
**intro | 可选 | string | 资源简介信息 |
**tags | 可选 | string[] | 资源标签信息,自多20个 |
**batchSignContracts | 可选 | object[] | 当前资源如果需要签约,则需要传递签约参数 |
**** resourceId | 必选 | string | 待签约的标的物ID |
**** subjectType | 必选 | int | 待签约的标的物类型 |
**** policyIds | 必选 | string[] | 待签约的标的物策略ID集 |
**authExcludedItems | 可选 | object[] | 授权排除项 |
****resourceId | 必选 | string | 受影响的资源ID |
****excludedType | 必选 | string | 排除类型(contractId:以合约ID作为排除属性 policyId:以策略ID作为排除属性) |
****excludedValue | 必选 | string | 具体的排除值,例如合约ID或者策略ID |
# 返回说明:
返回值字段 | 字段类型 | 字段说明 |
---|---|---|
resourceId | string | 资源ID |
resourceType | string | 资源类型[详见附表] |
resourceName | string | 资源名称 |
userId | int | 用户ID |
username | string | 用户姓名 |
coverImages | string[] | 封面图片 |
intro | string | 资源简介 |
tags | string[] | 资源标签集 |
latestVersion | string | 资源最大版本号 |
resourceVersions | object[] | 资源版本信息 |
** version | string | 资源版本号 |
** versionId | string | 资源版本Id |
** createDate | date | 版本创建时间 |
policies | object[] | 资源授权策略 |
baseUpcastResources | object[] | 基础上抛信息 |
** resourceId | string | 上抛资源ID |
** resourceName | string | 上抛资源名称 |
status | int | 状态 0:待发行(初始状态) 1:上架 2:冻结 4:下架(也叫待上架) |
# 示例
返回值是key-value键值对,key是创建资源的资源名称,status=1表示创建成功,status=2表示创建失败
{
"ret": 0,
"errcode": 0,
"msg": "success",
"data": {
"my-first-resource3": {
"status": 1,
"data": {
"resourceId": "5ef04fb1bfe6f11cb0424e50",
"latestVersion": "",
"intro": "资源简介",
"coverImages": [
"https://image.freelog.com/preview/b042cd88-cc9a-43fb-b8fb-1cae320b7977.jpg"
],
"tags": [
"t1",
"t2"
],
"status": 0,
"resourceName": "yuliang/my-first-resource3",
"resourceType": "text",
"userId": 50021,
"username": "yuliang",
"policies": [
{
"policyId": "15b30e2fba98bea17f1398d0521321e9",
"policyName": "free_policy",
"status": 1
}
],
"resourceVersions": [],
"baseUpcastResources": [],
"createDate": "2020-06-22T06:29:05.635Z",
"updateDate": "2020-06-22T06:29:05.635Z"
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38