简体   繁体   English

邮递员 Twilio Rest Api

[英]Postman Twilio Rest Api

Hi I was wondering if someone could help me ,I am trying to use twilios' rest api and im running into some trouble.嗨,我想知道是否有人可以帮助我,我正在尝试使用 twilios 的 rest api,但遇到了一些麻烦。 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" .实际请求中填写了 MyAccountIdSid、mySid 和电话号码,是不是我做错了什么,我收到您的“AccountSid 或 AuthToken 不正确”。 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 :我正在尝试发送短信 Post Request Url 我正在使用:

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. Twilio 开发人员布道者在这里。

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.如果您从这里复制它,请注意它的第一部分是请求,第二部分是响应,因此您尝试发送给 Twilio 的是响应,因此它对您不起作用。

What you need to send to Twilio is the following:您需要发送到 Twilio 的内容如下:

$ 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.我已经创建了一个快速的屏幕广播,向您展示如何使用邮递员 2 做到这一点。希望它对您有所帮助。

在此处输入图片说明

Note : Enhancement of Marcos Placona's Answer注意:增强 Marcos Placona 的答案

In the Authorization section, set 'AUTH TOKEN' in 'password' field.在授权部分,在“密码”字段中设置“授权令牌”。 You can find 'AUTH TOKEN' just below Account Summary.您可以在帐户摘要下方找到“AUTH TOKEN”。

https://www.twilio.com/console https://www.twilio.com/console

https://www.twilio.com/docs/api/errors/20003 https://www.twilio.com/docs/api/errors/20003

'Authenticate using your Account SID as the username, and your Auth Token as the password.' '使用您的帐户 SID 作为用户名进行身份验证,并使用您的身份验证令牌作为密码。'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM