2013-03-25 101 views
1

我想要创建一个按钮,将用户订阅到disqus线程。通过JSON - DISQUS API订阅用户

我需要一些DISQUS API的帮助 我已经玩了很多,也尝试过通过DISQUS控制台http://disqus.com/api/console/#!/ - 没有任何工作。

$.ajax({ 
    type: "POST", 
    url: "https://disqus.com/api/3.0/threads/subscribe.json", 
    data: { 
    "email": "[email protected]", 
    "thread": "ident:blog_post_123", 
    "forum": "myforum" 
    }, 
    success: function(data){alert(data);}, 
    dataType: "jsonp" 
}); 

结果总是

{ 
    "code": 2, 
    "response": "Invalid argument, 'forum'" 
} 

我在做什么错?我无法找到帮助我的东西...

谢谢!

回答

1

该文档是错误的,因为您实际上无法使用ident:或链接:因为'forum'不是可接受的参数。

相反,您需要进行另一次查找才能获得线程ID,以便首次使用该订阅调用。使用此标识符和论坛短名称的端点,然后从响应中获取“id”值:http://disqus.com/api/docs/threads/set/

+0

谢谢!这节省了我很多时间......我还了解到,你不能通过域名通过json/jsonp“发布”。现在我正在卷曲。 – mountbatt 2013-03-26 10:35:35