Need help converting to Twitter API v1.1 - JavaScript

前端 未结 1 1186
感情败类
感情败类 2021-01-03 09:32

Recently Twitter updated its API to v1.1 and my program stops working but no matter how much documentation I read, I can\'t seem to really understand what is needed to make

相关标签:
1条回答
  • 2021-01-03 10:31

    The reason it's not working

    In the wonderful world of bad ideas, Twitter is sunsetting this answer, as of May 2013, and will require, at minimum, that you either use one of their widgets, and shoehorn it in, or that you set up an application and do application-level authentication, even for public-timeline GET requests. [From this post]

    This is entirely true. You either 'hack' together something using their wigets (highly discouraged, and if they change one line of code in their widget, your code will stop working completely), or you do what they suggest and upgrade to authenticated requests using OAuth and the 1.1 API.

    Links you must read

    So, you can't just change the /1/ to /1.1/ in the URL and expect it to work.

    This post explains how the 1.0 API is deprecated, provides evidence from the twitter site, and explains how you need to perform authenticated requests.

    This post has a little information on the 1.1 API and how it returns JSON formatted data.

    This post explains how you'll get a 410 GONE status if you try and make any requests to the 1.0 API from now on, and what that means.

    This post explains what the error you're getting means

    ...and finally, This post explains step-by-step how, if you choose to use php as your server-side language, you make authenticated requests and requires a simple library (single file include) to get it to work.

    In Closing

    Don't hack something together using JavaScript, as soon as Twitter makes an update to their widget, that's it, you're screwed. Use a server-side language and do it properly as per their documentation.

    0 讨论(0)
提交回复
热议问题