参数 | 说明 | 是否必填 | 类型 |
---|---|---|---|
appId | 应用id | 是 | String |
templateId | 模板id | 是 | String |
Request URL: https://api.itniotech.com/wa/template/del Request Method: POST Request Headers: Content-Type: application/json;charset=UTF-8 Sign: 05d7a50893e22a5c4bb3216ae3396c7c Timestamp: 1630468800 Api-Key: bDqJFiq9 Request Body: { "appId":"xJdRffKR3", "templateId":"9379c9eaa23a4fd8a9d4fbe5f7c8d3f6" }
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见响应状态码说明 | String |
reason | 原因说明 | String |
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 身份验证错误 |
-2 | 模板状态不正确 |
-4 | 时间戳过期 |
-5 | 系统异常 |
-6 | IP受限 |
-7 | 参数校验异常 |
-8 | 参数校验异常 |
-10 | 应用不存在 |
-11 | 应用名称已存在 |
-12 | 网络异常,请稍后重试 |
-14 | 账号未认证 |
-38 | 当前模板不存在 |
-39 | 删除模板失败 |
-74 | 语言代码格式错误 |
-76 | 请输入正确的类型 |
-83 | 请输入正确的format参数 |
Java
PHP
REQUEST
package com.itniotech.api.demo.im; import cn.hutool.core.map.MapUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.http.Header; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Arrays; import java.util.HashMap; import java.util.Map; private static void delTemplate() { final String baseUrl = "https://api.itniotech.com/wa/"; final String apiKey = "your api key"; final String apiPwd = "your api secret"; final String appId = "your appid"; final String templateId = "template id"; //the template id final String url = baseUrl.concat("template/del"); HttpRequest request = HttpRequest.post(url); // currentTime final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond()); final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime)); request.header(Header.CONNECTION, "Keep-Alive") .header(Header.CONTENT_TYPE, "application/json;charset=UTF-8") .header("Sign", sign) .header("Timestamp", datetime) .header("Api-Key", apiKey); String body = JSONUtil.createObj() .set("appId", appId) .set("templateId", templateId) .toString(); HttpResponse response = request.body(body).execute(); if (response.isOk()) { String result = response.body(); System.out.println(result); } }
REQUEST
header('content-type:text/html;charset=utf8'); $apiKey = "your api key"; $apiSecret = "your api secret"; $appId = "your appid"; $timeStamp = time(); $sign = md5($apiKey.$apiSecret.$timeStamp); $headers = array('Content-Type:application/json;charset=UTF-8',"Sign:$sign","Timestamp:$timeStamp","Api-Key:$apiKey"); $url = "https://api.itniotech.com/wa/template/del"; $dataArr["appId"] = $appId; $dataArr["templateId"] = "template id"; $data = json_encode($dataArr); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600); curl_setopt($ch, CURLOPT_HTTPHEADER,$headers); curl_setopt($ch, CURLOPT_POSTFIELDS , $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $output = curl_exec($ch); curl_close($ch); var_dump($output);
RESPONSEEXAMPLE
{ "status": "0", "reason": "success" }