2014-10-02 41 views
0

我想獲得谷歌+份額計數不是+按鈕,但只有數量。我想,在ColdFusion的我用這: -獲取谷歌+分享次數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"}]}} 

回答

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>