尝试从Google+获取分享计数时出错

时间:2015-06-15 12:15:18

标签: jquery ajax google-plus

根据this教程,我应该首先发布到G +以获取计数: 我为项目创建了自己的API密钥,但在尝试访问地址栏中的URL时出错:

{"error":{"code":-32700,"message":"Parse Error","data":[{"domain":"global","reason":"parseError","message":"Parse Error"}]}}

使用Javascript:

    https://clients6.google.com/rpc?key=AIzaSyDTmz9L0Ed02ECQRnZ_8jxXMNB8msmb_zI

    var googleShare = "https://clients6.google.com/rpc?key=AIzaSyDTmz9L0Ed02ECQRnZ_8jxXMNB8msmb_zI";
    var postBody = [{
        "method": "pos.plusones.get",
        "id": "p",
        "params": {
            "nolog": true,
            //change the end of the URI, dpe
            "id": "https://triathlonresearch.org/members/quiz/questions/",
            "source": "widget",
            "userId": "@viewer",
            "groupId": "@self"
        },
        "jsonrpc": "2.0",
        "key": "p",
        "apiVersion": "v1"
    }];

    $.post({
        data: postBody,
        url: googleShare
    }).done(function (data) {
        console.log(data.metadata.globalCounts.count);
    });

0 个答案:

没有答案