如何使用ajax向github api发送put请求?

时间:2015-10-08 23:37:55

标签: jquery ajax api github github-api

我试图通过ajax调用通过github api关闭问题。我收到了404未找到的消息。

$.ajax({
    url: 'https://api.github.com/repos/fakeName/some_app/issues/36?state=closed&access_token=my_key',
    type: 'PUT',
    contentType: "application/json; charset=utf-8",
    success: function(result) {
        alert("complete!");
    }
});

1 个答案:

答案 0 :(得分:0)

这有效:

$.ajax({
        url: 'https://api.github.com/repos/some_name/some_app/issues/23?access_token=some_number',
        type: 'PATCH',
            data: '{"state": "closed" }',
            contentType: "application/json; charset=utf-8",
        success: function(result) {
        alert(JSON.stringify(result));
    }