I was wondering if anyone has successfully implemented the Twitter REST api? (as seen in the Manual’s example: http://manuals.matrix.squizsuite.net/web-services/chapters/rest-resource-assets/#Example ?
I’ve created a REST Resource Javascript as per the example in the Manual.
Selected the Authentication type as OAuth and have selected the REST Resource OAuth 2 Legged.
Entered the Consumer Key, Consumer Secret (both provided by Twitter) and have selected HMAC-SHA1 as the Signature Method.
And once I preview the REST resource javascript asset, I get a blank screen. Has anyone experienced the same issues as I have? Or is there something that I’ve missed?
Any help would be appreciated…
Has anyone successfully implemented the Twitter REST api?
Adeline, are you using authentication because you are trying to retrieve tweets from a protected (private) twitter feed? How have you gone at replicating the example in the manual of the public Matrix twitter feed? Are you able to retrieve those tweets correctly?
[quote]
Selected the Authentication type as OAuth and have selected the REST Resource OAuth 2 Legged.
[/quote]
I am pretty sure that Twitter does not support 2-legged OAuth - as such the standard REST Resource OAuth Session (which performs the standard 3-legged OAuth) may be more appropriate.
How you get an access token from that point and how that gets implemented into the Rest Resource JS asset is not that well documented, unfortunately, and is beyond my slowly fading personal Matrix knowledge (others may be able to help) - but certainly, the 2-legged OAuth is not the one you want.
Hope this helps somewhat.
[quote]
Adeline, are you using authentication because you are trying to retrieve tweets from a protected (private) twitter feed? How have you gone at replicating the example in the manual of the public Matrix twitter feed? Are you able to retrieve those tweets correctly?
[/quote]
I’m using the authentication type - OAuth 2 Legged. The tweets aren’t private https://twitter.com/sydney_business. And as for replicating the example in the manual, none of the Matrix tweets appeared.
[quote]
I am pretty sure that Twitter does not support 2-legged OAuth - as such the standard REST Resource OAuth Session (which performs the standard 3-legged OAuth) may be more appropriate.
How you get an access token from that point and how that gets implemented into the Rest Resource JS asset is not that well documented, unfortunately, and is beyond my slowly fading personal Matrix knowledge (others may be able to help) - but certainly, the 2-legged OAuth is not the one you want.
Hope this helps somewhat.
[/quote]
Thanks Luke, I'll try the OAuth Session with the 3-legged OAuth.
Hi Adeline,
[quote]
I’m using the authentication type - OAuth 2 Legged. The tweets aren’t private https://twitter.com/sydney_business. And as for replicating the example in the manual, none of the Matrix tweets appeared.
[/quote]
What are you trying to do: just list them, or have your Matrix site post to it? If the tweets are not private and you are only trying to read them (using the example in the manual), then you don’t necessarily need to create an OAuth Session at all.
Authenticating for Twitter is mainly only used if you need to post tweets, or if the feed you are trying to read is protected. (Authentication also lets you access a slightly larger request limit per hour at Twitter’s end, but this should not matter too much if the page you are including the feed into is cached by Matrix or something higher.)
If you only need to read a public feed, I would suggest first trying the example without an OAuth Session attached, and see how that goes.
[quote]
Hi Adeline,
What are you trying to do: just list them, or have your Matrix site post to it? If the tweets are not private and you are only trying to read them (using the example in the manual), then you don't necessarily need to create an OAuth Session at all.
Authenticating for Twitter is mainly only used if you need to post tweets, or if the feed you are trying to read is protected. (Authentication also lets you access a slightly larger request limit per hour at Twitter's end, but this should not matter too much if the page you are including the feed into is cached by Matrix or something higher.)
If you only need to read a public feed, I would suggest first trying the example without an OAuth Session attached, and see how that goes.
[/quote]
Thanks for the explanation Luke!
We're only using the REST resource JS to display the latest tweets as a feed (and not post tweets from Matrix).
I've started a new REST resource JS asset and it now works fine. Except after say 15 minutes and refreshing the page/asset, I get a blank screen.
Is there something else I need to do with the Timeout and/or Default Cache Expiry settings?