请求语法
POST /v2/repos/<RepoName>
Content-Type: application/json
Authorization: Pandora <auth>
{
"region": <Region>,
"schema": [
{
"key": <Key>,
"valtype": <ValueType>,
"elemtype": <ElemType>,
"required": <Required>,
"schema": [
...
]
},
...
],
"options":{
"withIP":<ipkeyname>
}
}
请求内容
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
RepoName | string | 是 | 消息队列名称命名规则: ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$ |
region | string | 是 | 计算与存储所使用的物理资源所在区域目前仅支持“nb”(华东区域) |
schema | array | 是 | 数据的字段信息由‘字段名称’、‘字段类型’、‘数组类型’、‘是否必填’组成 |
schema.key | string | 是 | 字段名称命名规则: ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$ |
schema.valtype | stringlongfloatdatebooleanarraymapjsonstring | 是 | 字符串整型64位精度浮点型RFC3339 日期格式布尔类型,值为 true 或 false数组map :嵌套类型,可嵌套,最多5层,类似于json objectjsonstring :符合 json 格式的字符串 |
schema.elemtype | string | 否 | 数组类型当schema.valtype:"array" 时必填目前仅支持long 、float 、string |
schema.required | bool | 否 | 是否必填用户在传输数据时 key 字段是否必填 |
options | map | 否 | 表达一些 repo 的可选项 |
options.withIP | string | 否 | 在写入的数据中加入用户的来源 IP 信息,并命名为 ipkeyname 字段,加入到 schema中,类型为 string;若命名为空则不加入。 |
示例
curl -X POST https://nb-pipeline.qiniuapi.com/v2/repos/Test_Repo \
-H 'Content-Type: application/json' \
-H 'Authorization: Pandora 2J1e7iG13J66GA8vWBzZdF-UR_d1MF-kacOdUUS4:NTi3wH_WlGxYOnXsvgUrO4XMD6Y=' \
-d '{
"region": "nb",
"schema": [
{
"key": "userName",
"valtype": "string",
"required": true
},
{
"key": "age",
"valtype": "float",
"required": true
},
{
"key": "addresses",
"valtype": "array",
"elemtype": "long",
"required": true
},
{
"key": "profile",
"valtype": "map",
"required": true,
"schema": [
{
"key": "position",
"valtype": "string",
"required": true
},
{
"key": "salary",
"valtype": "float",
"required": true
},
{
"key": "education",
"valtype": "array",
"elemtype": "string",
"required": false
}
]
}
]
}'
文档反馈
(如有产品使用问题,请 提交工单)