# 上传数据

### 获取数据集信息

本接口用于获取数据集的基本信息

> GET /v1/dataset/{{dataset\_id}}

```
Request:
curl "https://domain.com/v1/dataset/{{dataset_id}}" \
  -H "T-Key:{your_accesskey}" \
  -H "Content-Type: application/json" 
```

```
Response:
{
    "code":"", 
    "msg":"", 
    "data":{
        "hosting_method":1,
        "endpoint":"xxx",
        "bucket":"xxx",
        "oss_type":1,
        "dataset_type":1
        "upload_token":"xxx"
    }
}
```

返回字段说明

| 参数              | 类型     | 描述                                                                                   |
| --------------- | ------ | ------------------------------------------------------------------------------------ |
| hosting\_method | int    | 该数据集使用的存储形式，0为系统自带的存储，1为自主授权的云存储，2为自有存储。使用自有存储时，无法使用SDK上传文件，仅支持添加文件URL。              |
| endpoint        | string | 该数据集指定的OSS使用访问域名                                                                     |
| bucket          | string | 该数据集指定的OSS存储捅                                                                        |
| oss\_type       | int    | 当该数据集使用默认存储或者授权存储时，本字段表示OSS的类型，0表示默认存储，默认存储使用的是s3协议的存储，1表示阿里云存储，2表示亚马逊S3存储，3表示七牛云存储。 |
| dataset\_type   | int    | 该数据集的数据类型，0表示图片类型，1表示视频类型，2表示音频类型，3表示普通点云类型，4表示点云融合数据，5表示点云语义分割类型，6表示文本类型。           |
| upload\_token   | string | 当oss\_type为七牛云存储时，本字段会返回用于上传七牛的upload\_token                                         |

### 获取临时上传OSS URL

本接口用于获取上传文件时的临时url，临时url用于保护您的OSS的AK SK不会泄露，除七牛外的已经支持的OSS存储类型均可调用本接口上传文件(七牛云支持upload\_token的方式上传，upload\_token已经在获取数据集信息的接口中返回)。

> POST /v1/dataset/{{dataset\_id}}/get-upload-url

```
Request:
POST "https://domain.com/v1/dataset/{{dataset_id}}/get-upload-url" \
  -H "T-Key:{your_accesskey}" \
  -H "Content-Type: application/json"
  -d '{"object":"a/b/test.mp4"}'
```

请求数据说明

| 参数     | 类型     | 说明                                                  |
| ------ | ------ | --------------------------------------------------- |
| object | string | 存储至OSS的object名称，请传入您认为完整的路径。最终存放至OSS中，路径前缀将会是数据集ID。 |

```
Response:
{
  "code": "",
  "msg": "",
  "data": {
    "url": "xxxx"
  }
}
```

返回字段说明

| 参数  | 类型     | 描述                       |
| --- | ------ | ------------------------ |
| url | string | 用于上传文件至OSS的presigned URL |

### 上传数据及标注结果

一份数据及对应的标注结果，支持多个文件数据一起提交（数组格式，如单个文件则支持单独object提交）upload到数据中心存储。

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

**请求参数**

| 参数         | 类型     | 是否必传 | 描述                                                                                  |
| ---------- | ------ | ---- | ----------------------------------------------------------------------------------- |
| ref\_id    | string | 否    | 用于和业务系统中数据的对应检索的唯一ID，虽非必传，但强烈建议传入，否则后续将无法和业务系统关联。最大长度64                             |
| name       | string | 是    | 文件名称，最大长度256                                                                        |
| path       | string | 是    | 资源文件的访问URL，最大长度4096                                                                 |
| size       | int    | 是    | 文件大小，单位KB                                                                           |
| md5        | string | 是    | 文件摘要信息，长度32                                                                         |
| frame\_id  | string | 否    | 融合数据中必传，用于关联不同传感器数据用于可视化，最大长度64                                                     |
| sensor     | string | 否    | 融合数据中必传，用于融合数据关联显示和单独显示，为枚举值，pointcloud为点云，camera\_*0 至 camera\_9为相机，23D融合中将按照序号显示* |
| meta       | object | 否    | 用于检索的K/V信息，如{"weather":"sunny", "city":"beijing"}                                   |
| anotations | array  | 否    | 标注数据，可传入多个标签数据，可参考 [标签数据结构](/dataset/open-api/anotations.md)                        |

**请求样例**

```
POST http://{{host}}/v1/dataset/{{dataset_id}}/upload 
Content-Type: {{contentType}}
T-key: {{your_accesskey}}

[
    {
        "ref_id":"third_ref_id",
        "name":"文件名称",
        "path":"path/xxx/a.jpg",
        "size":100,
        "md5":"md5example-32length",
        "frame_id":"frame_000001",
        "sensor":"camera_0",
        "meta":{"weather":"sunny","city":"beijing"},
        "anotations":[
            {
                "label": "car",
                "instance":"instance-id",
                "type":"box2d",
                "attrs":{"truncate":"yes"},
                "data": {
                    "x":21.31,
                    "y":33.22,
                    "width":210,
                    "height":122
                }
            },
            {
                "label": "person",
                "instance":"id",
                "type":"polygon",
                "attrs":"",
                "data": [
                    {"x":22.22,"y":222.22},
                    {"x":22.22,"y":222.22},
                    {"x":22.22,"y":222.22}
                ]
            }
        ]
    }
]


Response:
{
  "code": "",
  "msg": "",
  "data": {
    "file_succ": 1,
    "file_fail": 0,
    "anotations_succ": 2,
    "anotations_fail": 0
  }
}
```


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
