首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ATT API通知资源

ATT API通知资源
EN

Stack Overflow用户
提问于 2011-10-13 05:44:31
回答 1查看 102关注 0票数 0

当我使用Javascript SDK向通知资源发出POST时,我会得到一个id。

代码语言:javascript
运行
复制
<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>

然后,当我向trip/5/messages发出GET请求时,它不会出现。

代码语言:javascript
运行
复制
<script type="text/javascript">
ATT.Request(
    "trip/13427/messages",
    "get",
    replaceWithYourOwnCallback,
    {"access_token" : "197d39aeb300c0a4b5e0b6a4d9624d0a"},
    postparams = null
);
</script>

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-10-13 06:28:46

为了将消息链接到您的行程,您必须在related_object_type和related_object_id中包含该行程:

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

post数据应如下所示:

代码语言:javascript
运行
复制
{"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"

}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7747005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档