TWOHD_Wretch API

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    TWOHD_Wretch API - Presentation Transcript

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

    + JH LeeJH Lee Nominate

    custom

    600 views, 1 favs, 2 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 600
      • 534 on SlideShare
      • 66 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 12
    Most viewed embeds
    • 65 views on http://changyy.pixnet.net
    • 1 views on http://74.125.153.132

    more

    All embeds
    • 65 views on http://changyy.pixnet.net
    • 1 views on http://74.125.153.132

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories