得到谷歌+分享计数coldfusion

时间:2014-10-02 17:24:59

标签: coldfusion count google-plus share

我想让谷歌+分享计数不是+按钮而只是数字计数。我希望在coldfusion中使用它: -

<cfhttp url="https://clients6.google.com/rpc?key=XXXXXXX" method="post">                
                    <cfhttpparam name="method" type="url" value="pos.plusones.get">
                    <cfhttpparam name="id" type="url" value="p">
                    <cfhttpparam name="params" type="url" value='{"id":"url of the page I want to show on","source":"widget","userId":"@viewer","groupId":"@self"}'>
                    <cfhttpparam name="jsonrpc" type="url" value="2.0">
                    <cfhttpparam name="key" type="url" value="p">
                    <cfhttpparam name="apiVersion" type="url" value="v1">
                    <cfhttpparam name="Content-type" type="header" value="application/json">

                </cfhttp>
                <cfoutput>#cfhttp.Filecontent#</cfoutput><cfabort>

我得到了这样的答复: -

{"error":{"code":400,"message":"Invalid request","data":[{"domain":"global","reason":"invalidParameter","message":"Invalid request"}]}}

1 个答案:

答案 0 :(得分:0)

根据https://www.sharedcount.com/documentation.php上的信息,您的语法错误。它应该是这样的:

 <cfhttp url="https://clients6.google.com/rpc?key=XXXXXXX" method="post"> 
    <cfhttpparam type="header" name="Content-Type" value="application/json" />
    <cfhttpparam type="body" value="#serializeJSON('[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"http://www.yourdomain.com/","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]')#">
 </cfhttp>