更新时间:2024-01-31 GMT+08:00
分享

生成解析任务

功能介绍

生成解析的短链。一次最多生成100个解析的短链。

URI

POST /v1/aim/resolve-tasks

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

Content-Type

String

请求体参数类型,该字段必须设置为:application/json。

表2 请求Body参数

参数

是否必选

参数类型

描述

tpl_id

String

智能信息模板ID,由9位数字组成。

最小长度:1

最大长度:9

sms_signs

Array of strings

短信签名列表,需要与最终发送短信的签名一致,才能解析。

说明:

最多传入5个签名,单个签名内容不包括中括号。

最小长度:1

最大长度:18

数组长度:1 - 5

resolving_times

Integer

短链最大解析次数。

说明:

个性化短链只支持最大解析数为1,设置其他值无效。

最小值:1

最大值:10000000

aim_code_type

String

生成短链类型。

  • group:群发

  • individual:个性化

generation_type

String

生成短码方式。

  • 1:标准

  • 2:自定义

说明:

默认1,即标准生成短码。

domain

String

自定义短链域名,样例:km2g.cn、km2g.cn/a1、km2g.cn/a1/b2。

说明:
  • 自定义短码即generation_type为2时,此参数为必填,域名需要提前申请。

  • 域名申请支持单独域名申请,也支持域名加路径申请,最多支持两层路径。

最大长度:100

expiration_time

Integer

失效时间(天)。aim_code_type为group时,取值范围为1~180;aim_code_type为individual个性化时,取值范围为1~7。

说明:

失效时间精确到秒,例如参数设置为1,创建时间为2022-07-22 21:10:12,过期时间为2022-07-23 21:10:12。

params

Array of CreateResolveTaskParam objects

短链参数列表。一次请求最多生成100个短链。

说明:
  • OPPO模板一次最多申请10个短链。

  • 群发短链每次调用最多申请一条。

表3 CreateResolveTaskParam

参数

是否必选

参数类型

描述

cust_flag

String

创建解析任务时填写用户唯一标识,手机号码或者任何的唯一标识,唯一标识不超过64个字符。 发送智能信息时则必须填客户的手机号码。样例为:130****0001。

最大长度:64

dync_params

Map<String,String>

动态参数。

说明:

使用动态参数模板时,aim_code_type字段只能为individual。

custom_url

String

自定义跳转地址。长度要求不超过256。

说明:
  • 未填时,终端用户点击短信原文中的短链后,跳转智能信息模板H5页

  • 已填时,终端用户点击短信原文中的短链后,跳转该字段对应的页面,填写时必须为http或https作为前缀

  • 使用自定义跳转链接功能请联系KooMessage运营人员进行域名备案

  • 自定义短码即generation_type为2时,不支持自定义跳转链接功能,传入的参数值无效

custom_short_code

String

自定义短码,支持长度为3到10位的数字或大小写字母。样例为:aDC123。

说明:

自定义短码即generation_type为2时,此参数为必填。

最小长度:3

最大长度:10

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

task_id

String

任务ID。

tpl_id

String

智能信息模板ID,由9位数字组成。

sms_signs

Array of strings

短信签名列表。

resolving_times

Integer

用户创建时提交的最大解析次数。

resolved_times

Integer

实际已解析数量统计。

说明:

预留字段。

aim_code_type

String

智能信息编码类型。

  • group:群发

  • individual:个性化

domain

String

自定义短链域名,样例:km2g.cn、km2g.cn/a1、km2g.cn/a1/b2。

expiration_time

Integer

失效时间(天)。

params

Array of CreateResolveTaskResultParam objects

短链列表。

表5 CreateResolveTaskResultParam

参数

参数类型

描述

cust_flag

String

创建解析任务时填写用户唯一标识,手机号码或者任何的唯一标识,唯一标识不超过64个字符。 发送智能信息时则必须填客户的手机号码。样例为:130****0001。

cust_id

String

租户ID。

dync_params

Map<String,String>

动态参数。

custom_url

String

自定义跳转地址。

说明:
  • 未填时,终端用户点击访问短信原文中的短链,跳转智能信息H5页

  • 已填时,终端用户点击访问短信原文中的短链,跳转客户填写的链接落地页,填写时必须为http或https作为前缀

aim_url

String

完整的短链连接地址,通过自己的短信渠道发送时,需要把该短链添加到短信模板中,并确保发送短信时的签名与创建短链时的签名保持一致。样例:km2g.cn/PDiWqc。

aim_code

String

智能信息编码,样例:PDiWqc。

ext_data

String

自定义扩展参数。

说明:

预留字段。

result_code

String

短链申请结果返回码。

  • 0:成功

  • 非0:失败,具体请参见错误码

error_message

String

短链申请结果错误描述。

generate_date

String

短链生成时间。样例为:2019-10-12T07:20:50Z。

expire_date

String

短链到期时间。样例为:2019-10-12T07:20:50Z。

resolved_date

String

解析时间。样例为:2019-10-12T07:20:50Z。

说明:

预留字段。

resolved_times

Integer

短链实际解析次数。

说明:

预留字段。

custom_short_code

String

自定义短码,支持长度为3到10位的数字或大小写字母。样例为:aDC123。

状态码: 400

表6 响应Body参数

参数

参数类型

描述

error_code

String

结果状态码。

error_msg

String

结果详情。

error_message

Object

结果详情。

说明:

该字段在以后可能会废弃,建议使用error_msg字段对接。

状态码: 500

表7 响应Body参数

参数

参数类型

描述

error_code

String

结果状态码。

error_msg

String

结果详情。

error_message

Object

结果详情。

说明:

该字段在以后可能会废弃,建议使用error_msg字段对接。

请求示例

  • 生成解析任务-个性化。模板ID为"600000001",短链最大解析次数为1次,过期时间为7天。

    https://koomessage.myhuaweicloud.cn/v1/aim/resolve-tasks
    
    {
      "tpl_id" : "600000001",
      "sms_signs" : [ "华为云KooMessage" ],
      "aim_code_type" : "individual",
      "resolving_times" : 1,
      "domain" : null,
      "expiration_time" : 7,
      "params" : [ {
        "cust_flag" : "131****0000",
        "dync_params" : {
          "param1" : "参数1",
          "param2" : "参数2",
          "param3" : "参数3",
          "param4" : "参数4"
        },
        "custom_url" : "https://www.example.com"
      }, {
        "cust_flag" : "131****0001",
        "dync_params" : {
          "param1" : "参数1",
          "param2" : "参数2",
          "param3" : "参数3",
          "param4" : "参数4"
        },
        "custom_url" : "https://www.example.com"
      } ]
    }
  • 生成解析任务-群发。模板ID为"600000002",短链最大解析次数为5次,过期时间为7天,域名为"km2g.cn"。

    https://koomessage.myhuaweicloud.cn/v1/aim/resolve-tasks
    
    {
      "tpl_id" : "600000002",
      "sms_signs" : [ "华为云KooMessage" ],
      "aim_code_type" : "group",
      "resolving_times" : 5,
      "domain" : "km2g.cn",
      "expiration_time" : 7,
      "params" : [ {
        "cust_flag" : "131****0000",
        "custom_url" : "https://www.example.com"
      } ]
    }
  • 生成解析任务-自定义短码。模板ID为"600000002",短链最大解析次数为5次,过期时间为7天,自定义短码为"abc123"。

    https://koomessage.myhuaweicloud.cn/v1/aim/resolve-tasks
    
    {
      "tpl_id" : "600000002",
      "sms_signs" : [ "华为云KooMessage" ],
      "aim_code_type" : "group",
      "resolving_times" : 5,
      "domain" : "km3g.cn",
      "expiration_time" : 7,
      "generation_type" : "2",
      "params" : [ {
        "cust_flag" : "131****0000",
        "custom_short_code" : "abc123"
      } ]
    }

响应示例

状态码: 200

返回信息。

{
  "task_id" : "80959fd0-dc23-42e3-9595-59a49ee6cccc",
  "tpl_id" : "600000002",
  "sms_signs" : [ "华为云KooMessage" ],
  "resolving_times" : 5,
  "aim_code_type" : "group",
  "domain" : "km2g.cn",
  "expiration_time" : 7,
  "params" : [ {
    "cust_flag" : "131****0000",
    "cust_id" : "231724915a62455ca356e10a085c9a23",
    "dync_params" : null,
    "custom_url" : "https://www.example.com",
    "aim_url" : "km2g.cn/PDARc6",
    "aim_code" : "PDARc6",
    "result_code" : "0",
    "error_message" : null,
    "generate_date" : "2022-07-18T21:02:44Z",
    "expire_date" : "2022-07-25T21:02:44Z",
    "custom_short_code" : null
  } ]
}

状态码

状态码

描述

200

返回信息。

400

非法参数。

500

内部错误。

错误码

请参见错误码

分享:

    相关文档

    相关产品