# 创建资源
# 调用方式: POST
# 接口地址:
https://api.freelog.com/v2/resources
1
# body传入参数说明:
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
name | 必选 | string | 资源名称,此处无需加上用户名 |
subjectType | 可选 | int | 标的物类型(1:普通资源 4:合集资源) 默认是1 |
resourceTitle | 可选 | string | 资源标题 |
resourceTypeCode | 必选 | string | 资源类型编号,当resourceTypeName不为空时,为父资源类型编号 |
resourceTypeName | 可选 | string | 资源类型名称 |
policies | 可选 | object[] | 资源策略信息 |
**policyName | 必选 | string | 策略名称(数组内唯一) |
**policyText | 必选 | string | 策略文本,encodeURIComponent编码 |
**status | 可选 | int | 1:上线 0:下线 |
coverImages | 可选 | string[] | 资源封面图,最多10张 |
intro | 可选 | string | 资源简介信息 |
tags | 可选 | string[] | 资源标签信息,自多20个 |
# body示例
{
"name":"my-first-resource",
"resourceType":"text",
"policies": [{ "policyName":"free_policy","policyText":"for%20public%3A%20%20%20initial1%3A%20%20%20%20active%20%20presentable%20%20%20terminate%20%20" }],
"intro":"资源简介",
"coverImages":[
"https://image.freelog.com/preview/b042cd88-cc9a-43fb-b8fb-1cae320b7977.jpg"],
"tags":["t1","t2"]
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 返回说明:
返回值字段 | 字段类型 | 字段说明 |
---|---|---|
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:下架(也叫待上架) |
# 示例
{
"ret": 0,
"errcode": 0,
"msg": "success",
"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
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
批量创建资源 →