本文为您介绍了C#调用QueryMessage查看短信状态。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
MessageId |
String |
是 |
1008***3003003 |
短信发送ID。 |
返回数据
名称 |
类型 |
示例值 |
描述 |
ResponseCode |
String |
OK |
短信提交的状态。 |
ResponseDescription |
String |
The SMS Send Request was accepted |
短信提交状态的详细描述。 |
To |
String |
6581177810 |
发送号码。 |
Status |
Number |
1 |
短信的发送状态:
- 1(Submitted)
- 2(Failed)
- 3(Delivered)
|
ErrorCode |
String |
DELIVERED |
短信的发送状态码。 |
ErrorDescription |
String |
success |
短信发送状态码的详细描述。 |
Message |
String |
Hello! |
短信内容。 |
SendDate |
String |
Mon, 24 Dec 2018 16:58:22 +0800 |
短信转发给运营商的时间。 |
ReceiveDate |
String |
Mon, 24 Dec 2018 16:58:22 +0800 |
短信收到运营商回执的时间。 |
NumberDetail |
String |
号码的详细属性。 |
└Country |
String |
Hongkong, China |
号码所属国家。 |
└Region |
String |
HongKong |
Number Region。 |
└Carrier |
String |
CMI |
号码所属的运营商网络。 |
调用示例
- 初始化IClientProfile时,第一个参数(RegionId)必须为ap-southeast-1,请勿修改。
- Domain必须为dysmsapi.ap-southeast-1.aliyuncs.com,请勿修改。
- Version必须为2018-05-01,请勿修改。
using System;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Core.Exceptions;
using Aliyun.Acs.Core.Http;
namespace CommonRpc
{
class Program
{
static void Main(string[] args)
{
IClientProfile profile = DefaultProfile.GetProfile("ap-southeast-1", "<AccessKeyId>", "<AccessSecret>");
DefaultAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest
{
Method = MethodType.POST,
Domain = "dysmsapi.ap-southeast-1.aliyuncs.com",
Version = "2018-05-01",
Action = "QueryMessage"
};
// request.Protocol = ProtocolType.HTTPS;
request.AddQueryParameters("MessageId", "140101545641902498");
try
{
CommonResponse response = client.GetCommonResponse(request);
Console.WriteLine(response.Data);
}
catch (ServerException e)
{
Console.WriteLine(e);
}
catch (ClientException e)
{
Console.WriteLine(e);
}
}
}
}