开发者文档
GoTone SMS 联系人 API 帮助您管理通过唯一随机 ID 标识的联系人。使用此 ID,您可以创建、查看、更新或删除联系人。此 API 作为客户特定联系人的集合,允许您对其进行分组并分配自定义值,稍后可在发送短信模板消息时使用。
联系人 API 使用 HTTP 动词和 RESTful 端点结构,并使用访问密钥作为 API 授权。请求和响应负载使用 UTF-8 编码和 URL 编码值格式化为 JSON。
API 端点
https://app.gotonesms.net/api/http/contacts
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
创建一个新的联系人对象。GoTone SMS 在每次请求中返回创建的联系人对象。
API 端点
https://app.gotonesms.net/api/v3/contacts/{group_id}/store
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
| phone |
是
|
number | 联系人的电话号码。 |
| first_name | 否 |
string | 联系人的名字。 |
| last_name | 否 |
string | 联系人的姓氏。 |
curl-XPOSThttps://app.gotonesms.net/api/http/contacts/6065ecdc9184a/store \
-H'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
-d'{"phone":"8801721970168"}'
如果请求成功,返回联系人对象。
{
"status":"success",
"data":"contacts data with all details",
}
如果请求失败,将返回错误对象。
{
"status":"error",
"message":"A human-readable description of the error."
}
检索现有联系人的信息。您只需提供创建或接收时返回的唯一联系人 uid 和群组 uid。
API 端点
https://app.gotonesms.net/api/v3/contacts/{group_id}/search/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
| uid |
是
|
string | 联系人 uid |
curl-XPOSThttps://app.gotonesms.net/api/http/contacts/6065ecdc9184a/search/606732aec8705 \
-H'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
如果请求成功,返回联系人对象。
{
"status":"success",
"data":"contacts data with all details",
}
如果请求失败,将返回错误对象。
{
"status":"error",
"message":"A human-readable description of the error."
}
更新现有联系人。您只需提供创建时返回的唯一联系人 uid 和联系人群组 uid。
API 端点
https://app.gotonesms.net/api/v3/contacts/{group_id}/update/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
| uid |
是
|
string | 联系人 uid |
| phone |
是
|
number | 联系人的电话号码。 |
| first_name | 否 |
string | 联系人的名字。 |
| last_name | 否 |
string | 联系人的姓氏。 |
curl-XPATCHhttps://app.gotonesms.net/api/http/contacts/6065ecdc9184a/update/606732aec8705 \
-H'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
-d'{"phone":"8801821475168"}'
如果请求成功,返回联系人对象。
{
"status":"success",
"data":"contacts data with all details",
}
如果请求失败,将返回错误对象。
{
"status":"error",
"message":"A human-readable description of the error."
}
删除现有联系人。您只需提供创建时返回的唯一联系人 uid 和群组 uid。
API 端点
https://app.gotonesms.net/api/v3/contacts/{group_id}/delete/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
| uid |
是
|
string | 联系人 uid |
curl-XDELETEhttps://app.gotonesms.net/api/http/contacts/6065ecdc9184a/delete/606732aec8705 \
-H'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
如果请求成功,返回联系人对象。
{
"status":"success",
"data":"contacts data with all details",
}
如果请求失败,将返回错误对象。
{
"status":"error",
"message":"A human-readable description of the error."
}
API 端点
https://app.gotonesms.net/api/v3/contacts/{group_id}/all
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
curl-XPOSThttps://app.gotonesms.net/api/http/contacts/6065ecdc9184a/all \
-H'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
如果请求成功,返回联系人对象。
{
"status":"success",
"data":"contacts data with pagination",
}
如果请求失败,将返回错误对象。
{
"status":"error",
"message":"A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/contacts
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
创建一个新的群组对象。GoTone SMS 在每次请求中返回创建的群组对象。
API Endpoint
https://app.gotonesms.net/api/v3/contacts
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| name |
是
|
string | 群组的名称 |
curl -X POST https://app.gotonesms.net/api/http/contacts \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"name":"Codeglen"}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "group data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
检索现有群组的信息。您只需提供创建或接收时返回的唯一群组 ID。
API Endpoint
https://app.gotonesms.net/api/v3/contacts/{group_id}/show/
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
curl -X POST https://app.gotonesms.net/api/http/contacts/6065ecdc9184a/show \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "group data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
更新现有群组。您只需提供创建时返回的唯一 ID。
API Endpoint
https://app.gotonesms.net/api/v3/contacts/{group_id}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
| name |
是
|
string | 新的群组名称 |
curl -X PATCH https://app.gotonesms.net/api/http/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"name":"Codeglen Update"}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "groups data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
删除现有群组。您只需提供创建时返回的唯一 ID。
API Endpoint
https://app.gotonesms.net/api/v3/contacts/{group_id}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| group_id |
是
|
string | 联系人群组 uid |
curl -X DELETE https://app.gotonesms.net/api/http/contacts/6065ecdc9184a \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "null",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/v3/contacts/
curl -X GET https://app.gotonesms.net/api/http/contacts \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "group data with pagination",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
GoTone SMS 可编程短信 API 使您能够从 Web 应用程序以编程方式发送短信。首先,您需要创建一个新的消息对象。GoTone SMS 在每次请求中返回创建的消息对象。
使用此示例请求发送您的第一条短信。
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| recipient |
是
|
string | 要发送消息的号码。使用逗号 (,) 发送多个号码。例如:31612345678,8801721970168 |
| sender_id |
是
|
string | 消息的发送者。可以是电话号码(包括国家代码)或字母数字字符串。如果是字母数字字符串,最大长度为 11 个字符。 |
| type |
是
|
string | 消息的类型。对于文本消息,您需要插入 plain 作为短信类型。 |
| message |
是
|
string | 短信的内容。 |
| schedule_time |
否
|
datetime | 消息的预定日期和时间,RFC3339 格式 (Y-m-d H:i) |
| dlt_template_id |
否
|
string | 您注册的 DLT(分布式账本技术)内容模板的 ID。 |
curl -X POST https://app.gotonesms.net/api/http/sms/send \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"31612345678",
"sender_id":"SignOTP",
"type":"plain",
"message":"Your verification code is 123456."
}'
curl -X POST https://app.gotonesms.net/api/http/sms/send \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"31612345678,880172145789",
"sender_id":"SignOTP",
"type":"plain",
"message":"Your verification code is 123456.",
"schedule_time=2021-12-20 07:00"
}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
您可以使用 GoTone SMS 短信 API 检索现有入站或出站短信的信息。
您只需提供创建或接收时返回的唯一消息 ID。
API Endpoint
https://app.gotonesms.net/api/v3/sms/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| uid |
是
|
string | 在 GoTone SMS 平台上创建的唯一随机 uid,在创建对象时返回。 |
curl -X GET https://app.gotonesms.net/api/http/sms/606812e63f78b \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/v3/sms/
curl -X GET https://app.gotonesms.net/api/http/sms \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with pagination",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
GoTone SMS 可编程短信 API 使您能够从 Web 应用程序以编程方式发送短信。首先,您需要创建一个新的消息对象。GoTone SMS 在每次请求中返回创建的消息对象。
使用此示例请求发送您的第一条短信。
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| recipient |
是
|
string | 要发送消息的号码 |
| sender_id |
是
|
string | 消息的发送者。可以是电话号码(包括国家代码)或字母数字字符串。如果是字母数字字符串,最大长度为 11 个字符。 |
| type |
是
|
string | 消息的类型。对于语音消息,您需要插入 voice 作为短信类型。 |
| language |
是
|
string | 消息需要以何种语言读给接收者。可能的值: cy-gb, da-dk, de-de, el-gr, en-au, en-gb, en-gb-wls, en-in, en-us, es-es, es-mx, es-us, fr-ca, fr-fr, id-id, is-is, it-it, ja-jp, ko-kr, ms-my, nb-no, nl-nl, pl-pl, pt-br, pt-pt, ro-ro, ru-ru, sv-se, ta-in, th-th, tr-tr, vi-vn, zh-cn, zh-hk。 |
| gender |
是
|
string | 消息需要以何种性别语音读给接收者。可能的值:male(男性), female(女性) |
| message |
是
|
string | 短信的内容。 |
| schedule_time |
否
|
datetime | 消息的预定日期和时间,RFC3339 格式 (Y-m-d H:i) |
curl -X POST https://app.gotonesms.net/api/http/sms/send \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"31612345678",
"sender_id":"SignOTP",
"type":"voice",
"language=en-gb",
"gender=female",
"message":"Your verification code is 123456."
}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
您可以使用 GoTone SMS 短信 API 检索现有入站或出站短信的信息。
您只需提供创建或接收时返回的唯一消息 ID。
API Endpoint
https://app.gotonesms.net/api/v3/sms/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| uid |
是
|
string | 在 GoTone SMS 平台上创建的唯一随机 uid,在创建对象时返回。 |
curl -X GET https://app.gotonesms.net/api/http/sms/606812e63f78b \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/v3/sms/
curl -X GET https://app.gotonesms.net/api/http/sms \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with pagination",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
GoTone SMS 可编程短信 API 使您能够从 Web 应用程序以编程方式发送短信。首先,您需要创建一个新的消息对象。GoTone SMS 在每次请求中返回创建的消息对象。
使用此示例请求发送您的第一条短信。
API Endpoint
https://app.gotonesms.net/api/http/sms/send
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| recipient |
是
|
string | 要发送消息的号码 |
| sender_id |
是
|
string | 消息的发送者。可以是电话号码(包括国家代码)或字母数字字符串。如果是字母数字字符串,最大长度为 11 个字符。 |
| type |
是
|
string | 消息的类型。对于彩信,您需要插入 mms 作为短信类型。 |
| media_url |
是
|
url | 彩信附件的 URL。支持的媒体类型:image/* |
| message |
否
|
string | 短信的内容。 |
| schedule_time |
否
|
datetime | 消息的预定日期和时间,RFC3339 格式 (Y-m-d H:i) |
curl -X POST https://app.gotonesms.net/api/http/sms/send \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"recipient":"31612345678",
"sender_id":"SignOTP",
"type":"mms",
"message":"Your verification code is 123456.",
"media_url=https://via.placeholder.com/150.jpg"
}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
您可以使用 GoTone SMS 短信 API 检索现有入站或出站短信的信息。
您只需提供创建或接收时返回的唯一消息 ID。
API Endpoint
https://app.gotonesms.net/api/v3/sms/{uid}
| 参数 | 必填 | 类型 | 描述 |
|---|---|---|---|
| uid |
是
|
string | 在 GoTone SMS 平台上创建的唯一随机 uid,在创建对象时返回。 |
curl -X GET https://app.gotonesms.net/api/http/sms/606812e63f78b \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
}'
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/v3/sms/
curl -X GET https://app.gotonesms.net/api/http/sms \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms reports with pagination",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/me
| 参数 | 必填 | 描述 |
|---|---|---|
| Authorization |
是
|
调用 API 时,请发送您的 API 令牌,身份验证类型设置为 Bearer(示例:Authorization: Bearer {api_token}) |
| Accept |
是
|
设置为 application/json |
API Endpoint
https://app.gotonesms.net/api/http/balance
curl -X GET https://app.gotonesms.net/api/http/balance \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "sms unit with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
API Endpoint
https://app.gotonesms.net/api/http/me
curl -X GET https://app.gotonesms.net/api/http/me \
-H 'Authorization: Bearer 49|LNFe8WJ7CPtvl2mzowAB4ll4enbFR0XGgnQh2qWY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
如果请求成功,返回联系人对象。
{
"status": "success",
"data": "profile data with all details",
}
如果请求失败,将返回错误对象。
{
"status": "error",
"message" : "A human-readable description of the error."
}
没有找到相关的信息?欢迎联系我们!
请仅依赖我们官方网站发布的信息来获取有关我们业务和服务的准确信息。