智能日志管理平台

  • 智能日志管理平台 > API 文档 > 工作流 API > 创建消息队列(数据源)

    创建消息队列(数据源)

    最近更新时间: 2018-09-26 15:19:25

    请求语法

    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 string

    long

    float

    date

    boolean

    array

    map

    jsonstring
    字符串

    整型

    64位精度浮点型

    RFC3339 日期格式

    布尔类型,值为 true 或 false

    数组

    map:嵌套类型,可嵌套,最多5层,类似于json object

    jsonstring:符合 json 格式的字符串
    schema.elemtype string 数组类型
    schema.valtype:"array"时必填
    目前仅支持longfloatstring
    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
                  }
                ]
            }
        ]
    }'
    
    以上内容是否对您有帮助?
  • Qvm free helper
    Close