Your SlideShare is downloading. ×
0
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
TWOHD_Wretch API
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

TWOHD_Wretch API

5,609

Published on

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,609
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Wretch Open API
  • 2. <ul><li>Introduction </li></ul><ul><li>Wretch API </li></ul><ul><ul><li>API List </li></ul></ul><ul><ul><li>Policy </li></ul></ul><ul><ul><li>Format </li></ul></ul><ul><li>Examples </li></ul><ul><li>References </li></ul>
  • 3. Introduction <ul><li>Wretch Open API enables 3-parties to develop lots of interesting applications and grow up engagement for audience. </li></ul><ul><li>Basic information: </li></ul><ul><ul><li>Allow operations: GET / POST </li></ul></ul><ul><ul><li>Doc: http://tw.developer.yahoo.com/wretch/api.php </li></ul></ul><ul><ul><li>URI: </li></ul></ul><ul><ul><li>http://wretch.yahooapis.com/v1/ [API Method] ? [Parameters] </li></ul></ul>
  • 4. Get UGC (commercial) API Oauth (authentication)API John
  • 5. Introduction <ul><li>Examples: </li></ul><ul><ul><ul><li>L+ : 店家照片 (album list, photo list) </li></ul></ul></ul><ul><ul><ul><li>Campaign: 無名生活圈 (user cover, profile, friend list) </li></ul></ul></ul>
  • 6. API List (I) <ul><li>Site Information </li></ul><ul><ul><li>siteAlbumCategories :取得相簿全站分類列表 </li></ul></ul><ul><ul><li>siteVideoCategories :取得影音全站分類列表 </li></ul></ul><ul><ul><li>siteDiguAnnounces :取得 20 則全站最新嘀咕 </li></ul></ul><ul><li>Profile </li></ul><ul><ul><li>profileService/[guid ] :取得 user 個人資料 ( 即名片頁 ) </li></ul></ul><ul><ul><li>profileService/[guid]/idTransformation :轉換 user 的 GUID 為 WID </li></ul></ul><ul><ul><li>profileService/[guid]/idValidation :確認此 GUID 對應的 WID 是否已被註冊 </li></ul></ul><ul><ul><li>profileService/[guid]/cover/[cover_size ] :取得 user 大頭貼 </li></ul></ul>
  • 7. API List (II) <ul><li>Album </li></ul><ul><ul><li>albumService/[guid ] :取得 user 相簿服務狀態 </li></ul></ul><ul><ul><li>albumService/[guid]/albums :取得 user 相簿列表 </li></ul></ul><ul><ul><li>albumService/[guid]/albums :開一本新相簿 (POST) </li></ul></ul><ul><ul><li>albumService/[guid]/categories :取得 user 相簿個人分類列表 </li></ul></ul><ul><ul><li>albumService/[guid]/album/[album_id ] :取得 user 某一本相簿之相片列表 </li></ul></ul><ul><ul><li>albumService/[guid]/album/[album_id ] :在 user 的某一本相簿上傳一張照片 (POST) </li></ul></ul><ul><ul><li>albumService/[guid]/album/[album_id]/photo/[photo_id ] :取得 user 的某一張相片的相關資訊 </li></ul></ul>
  • 8. API List (III) <ul><li>Blog </li></ul><ul><ul><li>blogService/[guid ] :取得 user 網誌服務狀態 </li></ul></ul><ul><ul><li>blogService/[guid]/categories :取得 user 網誌個人分類列表 </li></ul></ul><ul><ul><li>blogService/[guid]/category/[category_id ] :取得 user 網誌屬於某一個人分類之文章列表 </li></ul></ul><ul><ul><li>blogService/[guid]/articles :取得 user 文章列表 </li></ul></ul><ul><ul><li>blogService/[guid]/articles :在 user 的 blog 發表文章 (POST) </li></ul></ul><ul><ul><li>blogService/[guid]/article/[article_id ] :取得 user 的某篇文章資訊及文章的前三行預覽 </li></ul></ul>
  • 9. API List (IV) <ul><li>Video </li></ul><ul><ul><li>videoService/[guid ] :取得 user 影音服務狀態 </li></ul></ul><ul><ul><li>videoService/[guid]/videoes :取得 user 影音列表 </li></ul></ul><ul><ul><li>videoService/[guid]/videoes :上傳一則影音 (POST) </li></ul></ul><ul><ul><li>videoService/[guid]/video/[video_id ] :取得 user 某則影音及該則影音之相關資訊 </li></ul></ul><ul><ul><li>videoService/[guid]/categories :取得 user 影音個人分類列表 </li></ul></ul><ul><ul><li>videoService/[guid]/category/[category_id ] :取得 user 某個影音分類下的影音列表 </li></ul></ul>
  • 10. API List (V) <ul><li>Friend </li></ul><ul><ul><li>friendService/[guid ] :取得 user 好友服務狀態 </li></ul></ul><ul><ul><li>friendService/[guid]/friends :取得 user 的好友列表 </li></ul></ul><ul><ul><li>friendService/[guid]/friendGroups :取得 user 的好友群組列表 </li></ul></ul><ul><ul><li>friendService/[guid]/friendGroup/[group_id ] :取得 user 的某一好友群組列表 </li></ul></ul><ul><ul><li>friendService/[guid]/mutualFriends :取得與 user 互加好友列表 </li></ul></ul><ul><ul><li>friendService/[guid]/reverseFriends :取得加此 user 為好友之列表 </li></ul></ul>
  • 11. API List (VI) <ul><li>Digu </li></ul><ul><ul><li>diguService/[guid ] :取得 user digu 的服務狀態 </li></ul></ul><ul><ul><li>diguService/[guid]/messages :發表 ( 回覆 ) digu 訊息 (POST) </li></ul></ul><ul><ul><li>diguService/[guid]/message/[msg_id ] :取得 user 所發表的某則 digu 訊息 </li></ul></ul><ul><ul><li>diguService/[guid]/message/[msg_id ] :刪除 user 所發表的 digu 訊息 (DELETE) </li></ul></ul><ul><ul><li>diguService/[guid]/myDigus :取得 user 的 &amp;quot; 我的嘀咕 &amp;quot; </li></ul></ul><ul><ul><li>diguService/[guid]/allDigus :取得 user 的 &amp;quot; 一起嘀咕 &amp;quot; </li></ul></ul><ul><ul><li>diguService/[guid]/diguReplies :取得 user 的 &amp;quot; 對我嘀咕 &amp;quot; </li></ul></ul><ul><ul><li>diguService/[guid]/followers :取得 user 的訂閱列表 </li></ul></ul><ul><ul><li>diguService/[guid]/followings :取得訂閱 user 的列表 </li></ul></ul><ul><ul><li>diguService/[guid]/subscriptions :訂閱 user 的嘀咕 (POST) </li></ul></ul><ul><ul><li>diguService/[guid]/subscription :取消訂閱 user 的嘀咕 (DELETE) </li></ul></ul>
  • 12. Data access policy (I) <ul><li>Public data: user profile, cover, connection (friend list) </li></ul><ul><ul><li>判斷條件 : </li></ul></ul><ul><ul><ul><li>不需判斷 viewer 與 owner 間的關係 -&gt; output public data </li></ul></ul></ul><ul><li>User Content ( 除 Digu 外 ) </li></ul><ul><ul><li>判斷條件 : </li></ul></ul><ul><ul><ul><li>1. Viewer 是否等於 Owner </li></ul></ul></ul><ul><ul><ul><li>2. Owner 該 service 是否有開啟 </li></ul></ul></ul><ul><ul><ul><li>3. Viewer 與 Owner 是否互為好友 </li></ul></ul></ul><ul><ul><ul><li>§ (TRUE == 1) -&gt; 200, output all data </li></ul></ul></ul><ul><ul><ul><li>§ (FALSE == 1) &amp;&amp; (FASLE == 2) -&gt; 404 </li></ul></ul></ul><ul><ul><ul><li>§ (FALSE == 1) &amp;&amp; (TRUE == 2) &amp;&amp; (TRUE == 3) -&gt; 200, output public data </li></ul></ul></ul><ul><ul><ul><li>§ (FALSE == 1) &amp;&amp; (TRUE == 2) &amp;&amp; (FALSE == 3) -&gt; 404 </li></ul></ul></ul>
  • 13. Data access policy (II) <ul><li>Digu </li></ul><ul><ul><li>判斷條件 : </li></ul></ul><ul><ul><ul><li>Viewer 是否等於 Owner </li></ul></ul></ul><ul><ul><ul><li>Owner 的 digu 是否需授權 , 如果是 , 那 viewer 是否經 Owner 授權閱讀 </li></ul></ul></ul><ul><ul><ul><li>Viewer 與 Owner 是否互為好友 </li></ul></ul></ul>
  • 14. Format Request = Action + URI Response = Status Code + body Status code Meaning of status code 200 query format 正確 , 且有 result 204 query format 正確 , 但沒有 result (ex: 相簿裡沒有相片 ) 404 query format 有誤 , 包含 : error typing, 格式錯誤 , 或是此 resource 不存在 (ex: 沒開啟服務 ) 等 406 沒有指定 valid accept format ( 包含 application/xml 及 application/json), 請用 format 參數指定或是在 request header 中的 accept 指定為 valid value
  • 15. Examples <ul><li>GET </li></ul>&lt;?php define(&amp;quot;API_KEY&amp;quot;,&amp;quot;dj0yJmk9MUdiT0lHRU92MXMzJmQ9WVdrOU5taGhjVlpNTnpJb WNHbzlNVGc0TWpJd056VTJNUS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1kNw--&amp;quot;); define(&amp;quot;SHARED_SECRET&amp;quot;, &amp;quot;f258b755c0a0b267f44dc594ec28a380cbabfc8c&amp;quot;); define(&amp;quot;APP_ID&amp;quot;, &amp;quot;6haqVL72&amp;quot;); // Initializes session and redirects user to Yahoo! to sign in and then authorize app $yahoo_session = YahooSession::requireSession(API_KEY, SHARED_SECRET, APP_ID); $url = &apos;http://wretch.yahooapis.com/v1/profileService/&apos;.$yahoo_user-&gt;guid; // Call Wretch API $response = $yahoo_session-&gt;client-&gt;get($url); print_r($response); ?&gt;
  • 16. Examples <ul><li>POST </li></ul>&lt;?php define(&amp;quot;API_KEY&amp;quot;,&amp;quot;dj0yJmk9MUdiT0lHRU92MXMzJmQ9WVdrOU5taGhjVlpNTnpJb WNHbzlNVGc0TWpJd056VTJNUS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1kNw--&amp;quot;); define(&amp;quot;SHARED_SECRET&amp;quot;, &amp;quot;f258b755c0a0b267f44dc594ec28a380cbabfc8c&amp;quot;); define(&amp;quot;APP_ID&amp;quot;, &amp;quot;6haqVL72&amp;quot;); // Initializes session and redirects user to Yahoo! to sign in and then authorize app $yahoo_session = YahooSession::requireSession(API_KEY, SHARED_SECRET, APP_ID); $url = &apos;http://wretch.yahooapis.com/v1/albumService/&apos;.$yahoo_user-&gt;guid.’/albums’; // Call Wretch API $response = $yahoo_session-&gt;client-&gt;post($url, $contentType, $content); print_r($response); ?&gt;
  • 17. References <ul><li>Yahoo! Developer Network Home </li></ul><ul><ul><li>http:// developer.yahoo.com / </li></ul></ul><ul><li>Yahoo! Oauth Quick Start Guide </li></ul><ul><ul><li>http:// developer.yahoo.com/oauth/guide </li></ul></ul>

×