发布到yammer组正在抛出“访问被拒绝”

时间:2015-02-10 17:49:11

标签: javascript api yammer

以下是我用来发布给yammer组的代码。

    var testMessage = {
        body: "hello",
        group_id: 123456
    }

    var jsonObj = JSON.stringify(testMessage);

    accToken = responseObject.access_token.token;
    var accAuthHead = 'Bearer ' + accToken;

    $.ajax({
        url: "https://api.yammer.com/api/v1/messages.json",
        type: 'POST',
        headers: {
            'Authorization': accAuthHead.toString(),
        },
        data: testMessage,

        success: function (data) {
            alert("ajax post success.");
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("There was an error with the request." + textStatus + XMLHttpRequest.toString());
        }
    });

“错误:拒绝访问”在错误函数中抛出。如果我在这里做错了,请纠正我。

0 个答案:

没有答案