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
Examples
GET
<?php define("API_KEY","dj0yJmk9MUdiT0lHRU92MXMzJmQ9WVdrOU5taGhjVlpNTnpJb WNHbzlNVGc0TWpJd056VTJNUS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1kNw--"); define("SHARED_SECRET", "f258b755c0a0b267f44dc594ec28a380cbabfc8c"); define("APP_ID", "6haqVL72"); // 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); ?>
Examples
POST
<?php define("API_KEY","dj0yJmk9MUdiT0lHRU92MXMzJmQ9WVdrOU5taGhjVlpNTnpJb WNHbzlNVGc0TWpJd056VTJNUS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1kNw--"); define("SHARED_SECRET", "f258b755c0a0b267f44dc594ec28a380cbabfc8c"); define("APP_ID", "6haqVL72"); // 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); ?>
0 comments
Post a comment