
# 获取公开示例模板列表（废弃）
#### 功能介绍
获取公开示例模板列表。
![](https://support.huaweicloud.com/api-codeartsrepo/public_sys-resources/note_3.0-zh-cn.png)
当前API已经废弃，请使用[模板仓列表](https://support.huaweicloud.com/api-codeartsrepo/ListRepositoryTemplates.html)
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=CodeHub&api=GetTemplates)中调试该接口。
#### URI
GET /v1/repositories/repository_templates
表1Query参数 
| 参数            | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| platform      | 否    | String  | 模板平台类型                                                                                                                                                                                                                                                                                                                 |
| language      | 否    | String  | 语言类型                                                                                                                                                                                                                                                                                                                   |
| pipeline      | 否    | String  | 是否支持流水线                                                                                                                                                                                                                                                                                                                |
| entertype     | 否    | String  | 模板标签                                                                                                                                                                                                                                                                                                                   |
| search        | 否    | String  | 模板名称                                                                                                                                                                                                                                                                                                                   |
| dateorder     | 否    | String  | 模板日期排序                                                                                                                                                                                                                                                                                                                 |
| usedtimeorder | 否    | String  | 模板引用次数排序                                                                                                                                                                                                                                                                                                               |
| type          | 否    | String  | **参数解释：** 模板公开类型 **取值范围：** - SHARE 个人示例模板  - PUBLIC 公开只读   |
| region        | 否    | String  | 大区名称                                                                                                                                                                                                                                                                                                                   |
| page_no       | 是    | Integer | 分页页数                                                                                                                                                                                                                                                                                                                   |
| page_size     | 是    | Integer | 每页数据数                                                                                                                                                                                                                                                                                                                  |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                        |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。 通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码： 200**
表3响应Body参数 
| 参数     | 参数类型                                                                            | 描述                                                                                                                                                                                                                                                                                                                           |
|:---|:---|:---|
| error  | [Error] object                                   | 响应错误                                                                                                                                                                                                                                                                                                                         |
| result | [TemplateRepositoryList] object | 响应结果                                                                                                                                                                                                                                                                                                                         |
| status | String                                                                          | **参数解释：** 响应状态 **取值范围：** - success，表示接口调用成功。  - failed，表示接口调用失败。   |
   
 表4Error 
| 参数      | 参数类型   | 描述   |
|:---|:---|:---|
| code    | String | 错误码  |
| message | String | 错误信息 |
   
 表5TemplateRepositoryList 
| 参数       | 参数类型                                                                              | 描述   |
|:---|:---|:---|
| projects | Array of [TemplateRepository] objects | 模板列表 |
| total    | Integer                                                                           | 模板总数 |
   
 表6TemplateRepository 
| 参数                     | 参数类型             | 描述        |
|:---|:---|:---|
| id                     | Integer          | 模板唯一标识    |
| name                   | String           | 模板名称      |
| template_name          | String           | 模板关联仓库名称  |
| tags                   | Array of strings | 模板标签      |
| description            | String           | 模板描述      |
| brief_introduction     | String           | 模板简介      |
| auto_pending_pipelines | Integer          | 是否自动创建流水线 |
| language               | String           | 模板语言分类    |
| created_at             | String           | 模板创建时间    |
| used_times             | Integer          | 模板引用次数    |
| liked_times            | Integer          | 模板被点赞次数   |
| creator_name           | String           | 模板创建人     |
| https_url              | String           | 模板https链接 |
   
#### 请求示例
```
GET https://{endpoint}/v1/repositories/repository_templates
```
#### 响应示例
**状态码： 200**
OK
```
{
  "result" : {
    "projects" : [ {
      "id" : 453613,
      "name" : "javaMavenDemo",
      "template_name" : "javaMavenDemo",
      "tags" : [ "UnsupportedPipeline", "OTHERS", "鲲鹏 ARM64" ],
      "description" : "javaMavenDemo",
      "brief_introduction" : "javaMavenDemo",
      "auto_pending_pipelines" : 0,
      "language" : "OTHERS",
      "created_at" : "Sep 25, 2019 4:03:31 PM",
      "used_times" : 58,
      "liked_times" : 1,
      "creator_name" : "Codehub",
      "https_url" : "https://codehub.alpha.devcloud.intest.com/chentest00001/javaMavenDemo.git"
    } ],
    "total" : 100
  },
  "status" : "success"
}
```
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-codeartsrepo/ErrorCode.html)。
