邮递员 Twilio Rest Api [英] Postman Twilio Rest Api

查看:22
本文介绍了邮递员 Twilio Rest Api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以帮助我,我正在尝试使用 twilios 的 rest api,但遇到了一些麻烦.MyAccountIdSid,mySid 和电话号码在实际请求中填写,是不是我做错了什么,我得到您的AccountSid 或 AuthToken 不正确".有人可以告诉我正确的方式来提出这个发送短信的请求吗?我正在尝试发送短信我正在使用的发布请求网址:

https://api.twilio.com/2010-04-01/Accounts/MyAccountIdSid/Messages.json{"account_sid": "MyAccountIdSid","api_version": "2010-04-01","body": "HelloWorld",num_segments":1",num_media":1","date_created": "2010 年 8 月 18 日星期三 20:01:40 +0000",日期发送":空,"date_updated": "2010 年 8 月 18 日星期三 20:01:40 +0000",方向":出站 API",错误代码":空,错误消息":空,来自":+353xxxxxxxx",价格":空,"sid": "mySID",状态":排队",到":+353xxxxxxxxx","uri": "/2010-04-01/Accounts/MyAccountIdSid/Messages/mySid.json"}

解决方案

这里是 Twilio 开发者传道者.

如果您从

Hi I was wondering if someone could help me ,I am trying to use twilios' rest api and im running into some trouble. MyAccountIdSid,mySid and phone numbers are filled in in the actual request,Is there something i am doing wrong, I get Your "AccountSid or AuthToken was incorrect" . Can someone show me the correct way to make this request for sending an sms please. I am trying to send a text message Post Request Url i am using :

https://api.twilio.com/2010-04-01/Accounts/MyAccountIdSid/Messages.json


{
   "account_sid": "MyAccountIdSid",
   "api_version": "2010-04-01",
   "body": "HelloWorld",
   "num_segments": "1",
   "num_media": "1",
   "date_created": "Wed, 18 Aug 2010 20:01:40 +0000",
   "date_sent": null,
   "date_updated": "Wed, 18 Aug 2010 20:01:40 +0000",
   "direction": "outbound-api",
   "error_code": null,
   "error_message": null,
   "from": "+353xxxxxxxx",
   "price": null,
   "sid": "mySID",
   "status": "queued",
   "to": "+353xxxxxxxxx",
   "uri": "/2010-04-01/Accounts/MyAccountIdSid/Messages/mySid.json"
}

解决方案

Twilio developer evangelist here.

If you're copying it from here, be aware that the first part of it is the request, and the second is the response, so what you're trying to send to Twilio is the response, hence why it's not working for you.

What you need to send to Twilio is the following:

$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json 
    -d "Body=Jenny%20please%3F%21%20I%20love%20you%20<3" 
    -d "To=%2B15558675309" 
    -d "From=%2B14158141829" 
    -d "MediaUrl=http://www.example.com/hearts.png" 
    -u 'AC36b9a6be2f98274fe61d15b63aabf1e0:{AuthToken}'

I've created a quick screeencast showing you how to do that with postman 2. Hope it helps you.

这篇关于邮递员 Twilio Rest Api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆