Twiter and new REST API


(Eric) #1

Hi all,

 

Has anyone here had a go at integrating twitter in to Matrix using new API? Twitter killed old API and RSS which we used to pull twits on to our site. After spending half a day on Twitter documentation (which is a mess at the moment and contains mixture of old and new) I am no closer to the answer.

 

I know it should be possible with Matrix REST resource and JSON datasource, but I haven't worked it out yet.

 

So if anyone done this already could you be so kind and share or give us some pointers.


(Edison Wang) #2

Have a look at this example:

http://manuals.matrix.squizsuite.net/web-services/chapters/rest-resource-assets#Example

 

We have updated the manual to use new Twitter API to display tweets.

As far as i know, they will require Oauth authentication to display tweets now, so no more public tweets.


(Eric) #3

I have tried to setup twitter feed according to instructions, but quickly realised we a re running v4.10.1 and instructions assume v.4.10.3

Some fields are missing from details screen of Oauth asset.

Any other way to do it?

 

Our upgrade is in September...


(Nic Hubbard) #4

I got it setup correctly. But one thing that was an issue is it doesn't show any of the OAuth errors that might occur.

 

What settings did you use? Did you make sure to set the Redirection for Auth option to yes?


(Eric) #5

OAuth authentication works fine, but when I get to this step "Add a REST Resource JavaScript asset under your site" and then run test, test fails. and shows me this

 

"request" => array ( "method" => "GET",
"headers" => array (
[Empty]
),
"body" => "",
"urls" => array (
0 => "https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=parracity&count=1"
),
"auth" => array (
"type" => "OAuth"
),
"oauth_headers" => array (
[Empty]
),
"url" => "https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=parracity&count=1"
),
"responses" => array (
0 => array (
"body" => "{\"errors\":[{\"message\":\"Bad Authentication data\",\"c...",
"headers" => array (
"content-length" => "61",
"content-type" => "application/json; charset=utf-8",
"date" => "Mon, 29 Jul 2013 04:22:39 UTC",
"server" => "tfe",
"set-cookie" => "guest_id=v1%3A137507175931123349; Domain=.twitter.com; Path=/; Expires=Wed, 29-Jul-2015 04:22:39 UTC",
"strict-transport-security" => "max-age=631138519"
),
"info" => array (
"url" => "https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=parracity&count=1",
"content_type" => "application/json; charset=utf-8",
"http_code" => 400,
"header_size" => 305,
"request_size" => 154,
"filetime" => -1,
"ssl_verify_result" => 0,
"redirect_count" => 0,
"total_time" => 0.679452,
"namelookup_time" => 0.009324,
"connect_time" => 0.171877,
"pretransfer_time" => 0.515744,
"size_upload" => 0,
"size_download" => 61,
"speed_download" => 89,
"speed_upload" => 0,
"download_content_length" => 61,
"upload_content_length" => 0,
"starttransfer_time" => 0.679444,
"redirect_time" => 0
),
"source" => "remote",
"expiry" => 0
)
),
"response" => array (
"body" => "{\"errors\":[{\"message\":\"Bad Authentication data\",\"c...",
"headers" => array (
"content-length" => "61",
"content-type" => "application/json; charset=utf-8",
"date" => "Mon, 29 Jul 2013 04:22:39 UTC",
"server" => "tfe",
"set-cookie" => "guest_id=v1%3A137507175931123349; Domain=.twitter.com; Path=/; Expires=Wed, 29-Jul-2015 04:22:39 UTC",
"strict-transport-security" => "max-age=631138519"
),
"info" => array (
"url" => "https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=parracity&count=1",
"content_type" => "application/json; charset=utf-8",
"http_code" => 400,
"header_size" => 305,
"request_size" => 154,
"filetime" => -1,
"ssl_verify_result" => 0,
"redirect_count" => 0,
"total_time" => 0.679452,
"namelookup_time" => 0.009324,
"connect_time" => 0.171877,
"pretransfer_time" => 0.515744,
"size_upload" => 0,
"size_download" => 61,
"speed_download" => 89,
"speed_upload" => 0,
"download_content_length" => 61,
"upload_content_length" => 0,
"starttransfer_time" => 0.679444,
"redirect_time" => 0
),
"source" => "remote",
"expiry" => 0
)
 

I assumed because it can't store access token. Sorry I am total noob when it comes to REST


(Nic Hubbard) #6
I assumed because it can't store access token. Sorry I am total noob when it comes to REST. 

 

Are you saying that in your 4.10.1 version it doesn't allow you to save access tokens? Or it just didn't work?


(Eric) #7

Yep that's what I am saying, according to manuals it was added in 4.10.3 :(


(Nic Hubbard) #8

Yep that's what I am saying, according to manuals it was added in 4.10.3 :(

 

Bummer. I don't think there is any other way to do it.