使用API发送短信
问题描述:
我联系了我的短信公司,并询问他们关于通过编程语言发送短信的API。
他们把下面的代码,但我不知道如何使用它在我的vb.net应用:使用API发送短信
通过这种方法,可以将消息发送到一个接触或接触多请求 :
POST http://api.yamamah.com/SendSMS
Host: api.yamamah.com
Content-Type: application/json
Body:
{
"Username": "",
"Password": "",
"Tagname": "",
"RecepientNumber": "05xxxxxx;05xxxxxx",
"VariableList": "",
"ReplacementList": "",
"Message": "test",
"SendDateTime": 0,
"EnableDR": False
}
Response
Status Code: 200
Content-Length: 70
Content-Type: application/json; charset=utf-8
Date: Sun, 26 Jan 2014 10:59:40 GMT
Returned message
{
"InvalidMSISDN": null,
"MessageID": "1d7d8d99-2da4-478a-8391-6783f467f479",
"Status": 1,
"StatusDescription": "Success"
}
答
研究如何在vb.net应用程序中使用REST webservice。
-
你的SMS公司共用了下面详细说明
- web服务的URL:http://api.yamamah.com/SendSMS
- HTTPS方法:POST
- 内容类型:应用/ JSON
- 消息JSON格式体。
您可以将邮件发送给多个联系人,因为收件人号码是以分号分隔的。 ( “RecepientNumber”: “05xxxxxx; 05xxxxxx”)
答
,因为它不是安全,请勿使用此提供程序API。根据您的示例,我可以确定他们没有使用SSL/TLS进行API调用,并且您的密码可能是,容易被您的计算机与其服务器之间的任何人盗用。要求他们支持更安全的沟通方式。
或者你也可以看看our API这也是HTTP REST API。您可以学习如何使用VB.NET over here发送带有JSON负载的HTTP请求。
那么它可能是按照我们tutorial on sending single sms.
然后检查了bulk sms API call用,而且发送短信很多这样的:
POST https://api.wavecell.com/sms/v1/{subAccountId}/many/compact
Host: api.wavecell.com
Content-Type: application/json
Body:
{
"destinations": [
"6598760000",
"+659870001",
"tel+659870002",
"+33(509)758-000"
],
"template": {
"source": "BRAND",
"text": "Your message for all clients"
}
}
你有问题,哪一部分?这看起来像一个简单的[Web请求](http://stackoverflow.com/a/4015346/2882256)与json作为正文。附加说明:向您的SMS提供商索取文件或简单示例。 –
全部,我无法将此代码转换为vb.net代码! – Ayden
这不是代码。这是[post](https://en.wikipedia.org/wiki/POST_(HTTP))请求。 –