2011-10-12 71 views
0

當我使用Javascript SDK向通知資源發出POST時,我得到一個id。ATT API通知資源

<script type="text/javascript"> 
ATT.Request(
    "notification", 
    "post", 
    function(){ //do stuff here }, 
    {"access_token" : my_access_token_here}, 
    { 
     "interfaces": [ 
       { 
          "interface_id": 1 
         }, 
       { 
          "interface_id": 2 
       }, 
       { 
          "interface_id": 3 
       }, 
       { 
          "interface_id": 4 
       } 
     ], 
     "custom_body": "This is a wonderful trip!", 
     "target_response_info_type": "activity", 
     "message_type": "22", 
     "interfaces_custom_body": [ 
       { 
          "interface_id": 1, 
          "custom_subject": "none", 
          "custom_body": "This is a wonderful trip!" 
       }, 
       { 
          "interface_id": 2, 
          "custom_subject": "none", 
          "custom_body": "This is a wonderful trip!" 
       }, 
       { 
          "interface_id": 3, 
          "custom_subject": "none", 
          "custom_body": "This is a wonderful trip!" 
       }, 
       { 
          "interface_id": 4, 
          "custom_subject": "none", 
          "custom_body": "This is a wonderful trip!" 
       } 
     ], 
     "do_not_send": "0" 
    } 
); 
</script> 

後來,當我發出GET請求跳閘/ 5 /消息,但卻沒有顯示出來。

<script type="text/javascript"> 
ATT.Request(
    "trip/13427/messages", 
    "get", 
    replaceWithYourOwnCallback, 
    {"access_token" : "197d39aeb300c0a4b5e0b6a4d9624d0a"}, 
    postparams = null 
); 
</script> 

我在做什麼錯?

回答

1

爲了將信息鏈接到您的行程必須包括在related_object_type那趟和related_object_id:

https://addtotrip.co/home/Resource?resource=notification

POST數據應該是這樣的:

{"access_token" : my_access_token_here}, 
{ 
    "related_object_type": "trip", 
    "related_object_id": "13427", 
    "interfaces": [ 
      { 
         "interface_id": 1 
        }, 
      { 
         "interface_id": 2 
      }, 
      { 
         "interface_id": 3 
      }, 
      { 
         "interface_id": 4 
      } 
    ], 
    "custom_body": "This is a wonderful trip!", 
    "target_response_info_type": "activity", 
    "message_type": "22", 
    "interfaces_custom_body": [ 
      { 
         "interface_id": 1, 
         "custom_subject": "none", 
         "custom_body": "This is a wonderful trip!" 
      }, 
      { 
         "interface_id": 2, 
         "custom_subject": "none", 
         "custom_body": "This is a wonderful trip!" 
      }, 
      { 
         "interface_id": 3, 
         "custom_subject": "none", 
         "custom_body": "This is a wonderful trip!" 
      }, 
      { 
         "interface_id": 4, 
         "custom_subject": "none", 
         "custom_body": "This is a wonderful trip!" 
      } 
    ], 
    "do_not_send": "0" 

}