+1

Twitter API

Michael Mikkelsen 12 years ago updated by John Heryer 12 years ago 5
I have found that some of the Twitter API calls are not working. I'll try to list them in this thread along with the error messages and any workarounds.

1. saved_searches/create

<wire>
<datasources>
<datasource name="twitter-savesearch" source="" query="/" providertype="twitter"/>
</datasources>

<main>
<panel name="searchPanel" width="70%" height="10%" background="#FFFFFF" align="center" cornerradius="15" clip="yes" borderwidth="1" bordercolor="FFFFFF" >
<text name="saveButton" width="20%" height="100%" align="right" alignment="center" font="helvetica" background="2222AA" color="ffffff" size="14" text="Save" clip="yes" onclickup="SaveTwitterSearch" ></text>
<textfield name="SearchText" alias="FIELD" height="90%" width="75%" rightof="Searchicon" padding-left="3" valign="center" placeholder="Search" autocorrect="no" color="#000000" alignment="left" valignment="center"/>
</panel>
</main>

<actions>

<action name="SaveTwitterSearch">
<assign property="datasource:twitter-savesearch.source" value="https://api.twitter.com/1/saved_searches/create.json?query=[object:FIELD.encodedtext]" />
</action>

<action name="ActionTwitterSaveSearch" datasource="twitter-savesearch" datasourceevent="querycomplete">
<if lhs="[datasource:twitter-savesearch.1.errors]" operator="ne" rhs="">
<alert message="SS [datasource:twitter-savesearch.dataSourceResultCount] Twitter Error. 1: [datasource:twitter-savesearch.1.errors]"/>
</if>
<if lhs="[datasource:twitter-savesearch.1.error]" operator="ne" rhs="">
<alert message="SS [datasource:twitter-savesearch.dataSourceResultCount] Twitter Error. [datasource:twitter-savesearch.1.error]"/>
</if>
</action>
</actions>
</wire>


providertype="twitter"
source="https://api.twitter.com/1.1/saved_sea..."
Twitter Error: message: Could not authenticate you, code: 32

providertype="twitter"
source="https://api.twitter.com/1/saved_searc..."
Twitter Error: Could not authenticate with OAuth.

No Workaround Found.
2. statuses/user_timeline (screen_name=[object:FIELDUSER.encodedtext])
(note: this api call does work for getting the authenticated users timeline but not other users timelines)

providertype="twitter"
source="https://api.twitter.com/1.1/statuses/..."
Twitter Error: message: Could not authenticate you, code: 32

providertype="twitter"
source="https://api.twitter.com/1/statuses/us..."
Twitter Error: message: Sorry, that page does not exist, code: 34

Workaround
providertype="json"
source="https://api.twitter.com/1/statuses/us..."

Limitations of workaround: protected users timeline will not be visible even if the authenticating user's follow request was accepted by the protected user. (no user authentication means only public feeds are available)
Michael,

Let me spend some time with these. I know we have a team in place to address these twitter 1.1 issues.
+1
There are two issues.

The first is a bug in the engine that does not properly use a post request to twitter with this api call. That has been fixed. If you can build an adhoc release with live updates you will have access to the fix immediately. If not, it will be released with the next version of fusebox in a couple of weeks.

Second,
First you must use the twitter 1.1 api:

https://dev.twitter.com/docs/api/1.1/...

So replace
https://api.twitter.com/1/saved_searches/create.json?query=[object:FIELD.encodedtext]
with
https://api.twitter.com/1.1/saved_searches/create.json?query=[object:FIELD.encodedtext]
Will I be able to assign the "datasource:twiterservice.postContent" property on a twitter datasource?
You shouldn't need to. Just append the post parameter to the url as shown above. It's a little inconsistant with our other datasource providers. The goal was to maintain backwards compatibility with apps that use the 1.0 frame work and do not take advantage of ios' native twitter support.