2010年11月17日 星期三

【轉貼】MSN Messenger 狀態查詢 API

【轉貼】MSN Messenger 狀態查詢 API


MSN Messenger 狀態查詢 API


語法:

http://messenger.services.live.com/users/[ID]/[resource]/[?queryparameters]
The [ID] is of format id@apps.messenger.live.com, where "id" is a numerical user ID. The [resource] is either:
  • presence: For presence JSON or JavaScript
  • presenceimage: for an image icon denoting the user’s presence

例如:
http://messenger.services.live.com/users/abc@hotmail.com/presence/?cb=showpresence

會傳回 JSON 資料:

showpresence(
{
    "icon": {
        "url": "http://www.wlmessenger.net/static/img/presence/Online.gif", 
         "height": 16, "width": 16    
          }, 

        "statusText": "Online", "status": "Online", "displayName": "nickname", 
        "id": "abc@hotmail.com", 
         "result": {        "code": 200, "response": "OK"    }
}
);

如果想在網頁放自己的MSN狀態
可以這樣
http://messenger.services.live.com/users/youmsnid@msn.com/presenceimage/">

http://msdn.microsoft.com/en-us/library/bb936687.aspx
這個文件說明
This is the status of the user. The value can be one of the following strings:
Online
Away
Idle
BeRightBack
Busy
OutToLunch
OnThePhone
Offline
應用:
若這個 API 查詢出對方是 Online 狀態
但 MSN 視窗顯示的是 Offline
嗯,那就表示對幫把你給封鎖了~~
補:
常常測出來都是 Offline (但對方實際是 Online)
因為對方沒授權被查詢
請對方到 http://settings.messenger.live.com/applications/WebSettings.aspx?wa=wsignin1.0

沒有留言:

張貼留言