Re: [問題] Plurk API 範例不能執行
以下分享我的使用心得:
官方提供的 Java 範例碼:
http://www.plurk.com/API/issueKey#java_example
API key 申請網址:http://www.plurk.com/API
下載 Apache's HttpClient Library:http://hc.apache.org/httpcomponents-client/
範例碼需要修改的地方:
一、
private static String API_KEY = "dKkIdUCoHo7vUDPjd3zE0bRvdm5a9sQi";
要把 dKkIdUCoHo7vUDPjd3zE0bRvdm5a9sQi 換成自己申請到的 API key,
二、
HttpGet httpget = new HttpGet(getApiUri("/Users/login?"+
"api_key=" + API_KEY + "&" +
"username=" + "user_x" + "&" +
"password=" + "user_x_pw"
));
user_x 與 user_x_pw 要用自己實際的 Plurk 帳號/密碼取代,
而且在執行程式前,要先登入自己的 Plurk。
三、
httpget = new HttpGet(getApiUri("/Timeline/plurkAdd?"+
"api_key=" + API_KEY + "&" +
"content=" + "Plurk+API+測試" + "&" +
"qualifier=" + "says" + "&" +
"qualifier_translated=" + "說" + "&" +
"lang=tr_ch"
));
content:要發送的訊息
qualifier:設定英文的修飾語,例如:says, likes, shares, gives... 等
qualifier_translated:將英文的修飾語改成其它語言的修飾語
lang:設定修飾語的語言,en代表英文,tr_ch代表正體中文
這樣就可以正常執行程式了 = =
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.44.7.126
※ 編輯: erotic 來自: 114.44.7.126 (12/28 00:52)
※ 編輯: erotic 來自: 114.44.7.126 (12/28 00:52)
→
12/30 16:06, , 1F
12/30 16:06, 1F
→
12/30 16:08, , 2F
12/30 16:08, 2F
→
12/30 21:43, , 3F
12/30 21:43, 3F
→
12/31 15:34, , 4F
12/31 15:34, 4F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 3 之 4 篇):