Want simple REST API end point to retrieve most recent tweet

ios

#1

I’ve been clicking around this convoluted mess for most of the day now. All I want to do is retrieve the text of the most current tweet on our account. I don’t want a widget, I don’t want to write an app, I don’t want to signup for premium Ad 3rd party whatever. Your documentation sucks, lots of references to concepts or items that aren’t linked. Examples are incomplete and/or don’t work. Getting started guides are linked to hells plumbing. I just want to get this seemingly simple task done for the boss and move on.


#2

Get user/show will do that. The user object includes the most recent tweet.

To use the REST API, you’ll need to create an app to obtain a consumer key and secret. I don’t know what language you’re using. I use perl. This is how I’d implement it:

use Twitter::API;
my $client = Twitter::API->new_with_traits(
    traits => [ qw/Enchilada AppAuth/ ],
    consumer_key => $ENV{TWITTER_CONSUMER_KEY},
    consumer_secret => $ENV{TWITTER_CONSUMER_SECRET},
);

my $token = $client->oauth2_token;
my $user = $client->show_user({
    screen_name => $username,
    tweet_mode => 'extended',
    -token => $token,
 });

say $user->{status}{full_text};

You’ll probably find a library like Twitter::API for your preferred language.


#3

I’m genuinely sorry that you feel this way. I’d personally be very grateful it if you would be kind enough to provide concrete examples of things that is broken or that we can improve, as quite frankly many of us are very familiar with the platform and do not always take enough time to recognise where we are not communicating clearly to others. I apologise if that is the case here.

You can provide feedback here: https://twittercommunity.com/c/dev-platform-feedback/dtc


#4

My question was clear, my comments were out of frustration that you have
now further fueled. Why don’t you try to help me understand your product
before begging me for edits to your documentation.

I’ll admit, I’m no social networking expert, but I have worked with
dozens of API’s to integrate with web sites. I know what I want to do,
but Twitter either won’t allow it, or the instructions are buried in a
maze of re-fabricated terms and disparate sites. For example, I look on
your API endpoint list
(https://developer.twitter.com/en/docs/api-reference-index,) I would
expect somewhere that there is an endpoint to access a ‘tweet.’ Nope, I
guess you call that a ‘statuses?’ GET statuses/lookup looks promising,
but where do I get a list of tweet ID’s?

From what I found, to get API creds I have to complete an application
that asks a lot of irrelevant information. All I want is the most recent
tweet, I’m not trying to make another Twitter client (which I have
gathered from forums that you are terrified of.) The other option was to
create an app. Again, I’m not making an f’n app, I’m not asking for
launch codes, I just want access to the data in my own Twitter account
that is public anyway. Why such a laborious application process? Most
API’s let you create creds from your account profile.

Where is your API sandbox where I can try stuff in a test environment?

The short story is that I wasted most of a day attempting to extract the
text of our most recent tweet. I’ve all but given up trying to use your
API. From what I’ve read in other forums, it appears that v. 1.1 of your
API is not for human consumption and that you are trying to discourage
developers from going outside the bounds of your pre-fab widgets. I can
accept that, it just would have been nice if you’d come clean early in
my reading.

My workaround was to scrape our public Twitter link. Not very efficient
for extracting 140 characters from a +300K return value, but I need to
move forward.

-E

PS. Twurl… really? Do we need yet another CLI http client?