필터 지우기
필터 지우기

Unable to tweet from Matlab

조회 수: 1 (최근 30일)
Sudharsan K.R
Sudharsan K.R 2019년 3월 27일
댓글: Sudharsan K.R 2019년 3월 28일
Currently trying to tweet from matlab. I have set up an app in twitter and then used the API keys respectively as below. But when I log into my twitter account, I am unable to see the tweet posted.
Kindly help me.
consumerkey = 'xxxx';
consumersecret = 'yyyy';
accesstoken = 'zzzz';
accesstokensecret = 'tttt';
c=twitter(consumerkey,consumersecret,accesstoken,accesstokensecret);
c.StatusCode
baseurl = 'https://api.twitter.com/1.1/account/settings.json';
tweetString = "Hello";
d = postdata(c,baseurl,'status',tweetString)
Output: -
ResponseMessage with properties:
StatusLine: 'HTTP/1.1 200 OK'
StatusCode: OK
Header: [1×25 matlab.net.http.HeaderField]
Body: [1×1 matlab.net.http.MessageBody]
Completed: 0
Edited by Guillaume: Replaced keys/secrets that allows anybody to impersonate you on twitter.
  댓글 수: 2
Guillaume
Guillaume 2019년 3월 27일
편집: Guillaume 2019년 3월 27일
Do not post secret keys on a public forum! This allows anybody to tweet on your behalf. I would recommend that you immediately requirest new keys from twitter as you do not know who may have seen the keys before I edited them. See Twitter's help on Securing keys and tokens
What is the content of Header and Body? Again, if it contains any sensitive information, edit that before posting it.
Sudharsan K.R
Sudharsan K.R 2019년 3월 27일
Thanks for your advice Guilaume.
This is what I am able to see when I call the HeaderField anf MessageBody. Am I missing anything?
HeaderField with properties:
Name: []
Value: []
MessageBody with properties:
Data: []
Payload: []
ContentType: []
ContentCoding: [0×0 string]

댓글을 달려면 로그인하십시오.

채택된 답변

Guillaume
Guillaume 2019년 3월 27일
According to this example, the base url to post tweet is
baseurl = 'https://api.twitter.com/1.1/statuses/update.json';
not the one you're using.
I don't have the datafeed toolbox (nor a twitter account) to test.
  댓글 수: 6
Guillaume
Guillaume 2019년 3월 28일
Clearly, one of your key or secret is no longer valid, so twitter reject your post. It's no longer a problem with the syntax. It's an authentication issue.
Sudharsan K.R
Sudharsan K.R 2019년 3월 28일
I just figured out that whenever I tag someone and then tweet, I am getting error. Otherwise I am able to tweet successfully. How to fix this?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Web Services from MATLAB Using HTTP에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by