2013-06-12 74 views
2

我想給一個簡單的GET用戶/顯示。我在Javascrit編碼,並且我在使用Api v.1的Http get請求中使用此URL來獲取用戶信息:https://api.twitter.com/1/users/show.json?screen_name=BillGates&include_entities=true。但現在給了我這個錯誤:如何通過Twitter Api v.1.1獲取用戶信息?

{ 
errors: [ 
{ 
message: "The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.", 
code: 68 
} 
] 
} 

於是我得到了API v1.1的URL是這樣的:https://api.twitter.com/1.1/users/show.json?screen_name=BillGates(從https://dev.twitter.com/docs/api/1.1/get/users/show明白了)。這個URL給我這個錯誤:

{ 
errors: [ 
{ 
message: "Bad Authentication data", 
code: 215 
} 
] 
} 

我是非常新的Twitter API。我需要用API v1.1替換API v1如果有人知道該怎麼做,那真的很感激。謝謝

+0

版本1已經退役..可以這可以幫助... https://dev.twitter.com/docs/api/1.1/overview –

+0

@Moni我在這裏有同樣的問題,你有沒有找到解決方案爲了這。 – satheeshwaran

+0

你需要使用oAuth。現在必須在服務器端完成。 – Seth

回答

1

我在我的C#應用​​程序中也有這個問題。當V1被棄用且V1.1開始生效時,它停止工作。當使用Twitterizer庫時,APIBaseAddress被設置爲默認值http://api.twitter.com/1/

我用下面的方法來更新我的Twitter帳戶 -

StatusUpdateOptions so = new StatusUpdateOptions(); 

TwitterResponse<TwitterStatus> tweetResponse = TwitterStatus.Update(tokens, tweet, so); 

今天,這打破了同樣的異常,因爲你的 -

The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview. 

但是我可以通過復位來解決這個APIBaseAddress狀態更新之前,像這樣 -

so.APIBaseAddress = "http://api.twitter.com/1.1/"; 

我是n不過,確保你如何在JavaScript中做到這一點,但一旦你指出了正確的地址,它應該工作。

也許類似下面 -

GET https://api.twitter.com/1.1/users/show.json 

ajax呼叫 -

$.ajax({ 
type: "GET", 
url: "http://api.twitter.com/1.1/users/show.json", 
datatype: "json" 
}); 
相關問題