Twitter Requests and APIs

I'm practically new to using the Twitter API, so bear with me for this:

I have no idea how to actually use the API on the website. I don’t understand how this will be implemented, because most tutorials recommend a separate jQuery / Javascript file for this, but it only complicates matters for me, because all I want the website to display is the last tweet I 'posted on my site.

So, back to the topic, I just read the GET status / user_timeline API documentation, but how can I use them on a website?

If I'm not mistaken, I need to send a GET REQUEST to the Twitter servers defining my user_id and display only 1 to display the first last tweet (which will be returned as text) on my website.

How should I do it?

+3
source share
1 answer

The endpoint will users/showalso automatically return your most recent tweet.

https://dev.twitter.com/docs/api/1/get/users/show

So something like

$.getJSON(
  "http://api.twitter.com/1/users/show.json?screen_name=BarackObama&callback=?",
  function(data) {
    alert(data.status.text);
  }
);

should work for you.

callback=? Designed for JSONP to perform cross-domain requests.

+2
source

All Articles