> For the complete documentation index, see [llms.txt](https://testindata.gitbook.io/dataset/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://testindata.gitbook.io/dataset/open-api/slice.md).

# 使用子集

### 获取子集列表

> GET http\://{{host}}/v1/dataset/{{dataset\_id}}/slices-list

```
GET http://{{host}}/v1/dataset/{{dataset_id}}/slices-list
Content-Type: application/json
T-key: {{T-key}}

Response:
{
  "code": "",
  "msg": "",
  "data": {
    "items": [
        {
            "ds_id": "ds_gsjzgjndgpayunpnyee3",
            "slc_id": "slc_e-okvcmdqrd_-iar",
            "slice_name": "一个23",
            "data_num": 3,
            "created_at": 1623752223
        }
    ]
  }
}


```

### 创建子集并添加文件

可将制定的文件归入到某个子集，子集可单独查看，也可以单独获取使用。

> POST http\://{{host}}/v1/dataset/{{dataset\_id}}/slices

请求参数

| 参数          | 类型     | 是否必传 | 描述     |
| ----------- | ------ | ---- | ------ |
| slice\_name | string | 是    | 子集名称   |
| fids        | string | 是    | 文件ID数组 |

```
POST http://{{host}}/v1/dataset/{{dataset_id}}/slices
Content-Type: application/json
T-key: {{T-key}}

{
    "slice_name": "slice_name",
    "fid": ["fid1", "fid2"]
}


Response:
{
  "code": "",
  "msg": "",
  "data": {
    "slc_id": "slc_8filvuzd4ejcr9iz",
    "succ_num": 1
  }
}
```

### 追加文件到子集

> POST http\://{{host}}/v1/dataset/{{dataset\_id}}/slices

请求参数

| 参数      | 类型     | 是否必传 | 描述     |
| ------- | ------ | ---- | ------ |
| slc\_id | string | 是    | 子集ID   |
| fids    | string | 是    | 文件ID数组 |

```
POST http://{{host}}/v1/dataset/{{dataset_id}}/slices
Content-Type: application/json
T-key: {{T-key}}

{
    "slc_id": "slice_id",
    "fid": ["fid1", "fid2"]
}


Response:
{
  "code": "",
  "msg": "",
  "data": {
    "slc_id": "slc_8filvuzd4ejcr9iz",
    "succ_num": 1
  }
}
```

### 获取子集信息

> GET http\://{{host}}/v1/dataset/{{dataset\_id}}/slices-info/{{slc\_id}}

请求示例

```
GET http://{{host}}/v1/dataset/{{dataset_id}}/slices-info/{{slc_id}}
Content-Type: application/json
T-key: {{T-key}}


Response:
{
  "code": "",
  "msg": "",
  "data": {
      "ds_id": "ds_gsjzgjndgpayunpnyee3",
      "dataset_name": "高清图",
      "slc_id": "slc_e-okvcmdqrd_-iar",
      "slice_name": "一个23",
      "data_num": 3,
      "created_at": 1623752223
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://testindata.gitbook.io/dataset/open-api/slice.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
