查询模板列表(V2)
功能介绍
查询模板列表。
调试
您可以在API Explorer中调试该接口。
URI
POST /v2/templates/action
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| action_id | 是 | String | 请填写固定值“query”。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 否 | String | 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
| X-Language | 否 | String | 语言类型,缺省值为“zh-cn”。 枚举值:
|
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| category | 否 | Array of strings | 模板分类数组。 |
| keyword | 否 | String | 搜索关键字,支持按名称和描述搜索,默认null。 |
| sort_by | 否 | String | 排序字段和排序顺序指定。比如:
|
| label | 否 | String | 标签:
|
| my_templates | 否 | Boolean | 是否查询用户自己创建的模板,默认查所有模板。 |
| status | 否 | Integer | 查所有模板时只处理上架的;查用户模板,需支持按状态查询,状态:
|
| status_array | 否 | Array of integers | 模板状态数组。 |
| has_notices | 否 | Boolean | 是否查询有消息的模板,默认查所有模板。 |
| productshorts | 否 | Array of strings | 模板关联的云产品(产品短名)列表。 |
| offset | 否 | Integer | 偏移量,表示从此偏移量开始查询,offset大于等于0。 |
| limit | 否 | Integer | 每页的模板条数。 |
| tag_ids | 否 | Array of strings | 模板关联的自定义标签列表。 |
| types | 否 | Array of integers | 模板类型:
|
| is_static | 否 | Integer | 动、静态代码模板标识:
|
| platform_source | 否 | Array of integers | 平台来源:
|
| tag_names | 否 | Array of strings | 模板关联的标签名称列表。 |
响应参数
状态码: 200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| count | Integer | 返回模板的数量。 |
| invalid_count | Integer | 返回关联了失效资源的模板数量。 |
| templates | Array of TemplateInfo objects | 返回模板的列表。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 模板id。 |
| title | String | 模板名。 |
| description | String | 模板描述。 |
| productshorts | Array of strings | 模板关联的所有云服务(产品短名)。 |
| products | Array of TemplateProductExt objects | 模板关联的云产品。 |
| topic | Array of TopicCategory objects | 模板标签。 |
| creator_id | String | 模板创建者id。 |
| creator | String | 模板创建者,有别名返回别名。 |
| nickname | String | 模板创建者,有别名返回别名。 |
| score | Integer | 模板评分(点赞数)。 |
| label | String | 模板标签(new、hot等)。 |
| store | Integer | 代码存储位置。 |
| store_info | String | 获取代码模版所需的信息。 |
| status | Integer | 模板状态:
|
| view_count | Integer | 访问量。 |
| usage_count | Integer | 引用量。 |
| created_at | String | 创建时间。 |
| updated_at | String | 更新时间。 |
| published_at | String | 模板上架时间。 |
| favorite_state | Integer | 点赞状态:
|
| tags | Array of TagInfo objects | 模板标签。 |
| type | Integer | 模板类型:
|
| is_static | Integer | 动、静态代码模板标识:
|
| maintainers | Array of strings | 模板相关联的所有维护人账号名称。 |
| pipeline_template | PipelineTemplateInfo object | 流水线模板信息 |
| platform_source | Integer | 平台来源:
|
| references | Array of Reference objects | 相关文档,示例,帖子。 |
| properties | Object | 模板自定义参数列表。 |
| dependencies | Array of objects | dependency信息。 |
| dependency_type | String | dependency类型。 |
| forum_id | Integer | 关联论坛板块id。 |
| file_size | Integer | 模板文件解压缩之后的大小(单位:KB)。 |
| deployment | Object | 部署信息。 |
| update_id | String | 模板关联更新态Id。 |
| is_support_cloudide | Boolean | 是否支持使用CodeArts IDE Online运行源码。 |
| has_notices | Boolean | 是否有消息 |
| dependents | Array of Dependent objects | 模板部署方式依赖信息 |
| dependent_services | String | 模板关联云服务。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 产品id。 |
| productshort | String | 产品短名。 |
| product_name | String | 产品名。 |
| home_link | String | 首页链接。 |
| api_link | String | api调试链接。 |
| sdk_link | String | sdk下载链接。 |
| doc_link | String | 文档链接。 |
| logo_link | String | logo链接。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| topic_id | String | topic的id。 |
| topic_name | String | topic的名称。 |
| category_id | String | topic对应的类别的id。 |
| category_name | String | topic对应的类别的名称。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 流水线模板的id。 |
| name | String | 流水线模板的名称。 |
| detail | String | 流水线模板的详细信息。 |
请求示例
{
"sort_by" : "desc(is_recommend),desc(usage_count)",
"offset" : 0,
"limit" : 10
} 响应示例
无
状态码
| 状态码 | 描述 |
|---|---|
| 200 | ok |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
错误码
请参见错误码。