当前位置 : 主页 > 网络编程 > JavaScript >

批量获取记录的回复

来源:互联网 收集:自由互联 发布时间:2021-06-28
tips-1099206_00.js { "app": 1, "record": 1, "order": "desc", "offset": 0, "limit": 10} tips-1099206_01.js { "comments": [ { "id": "2", "text": "aki \n确认了,没有问题。\n请继续加油。", "createdAt": "2017-11-15T11:54:00Z", "cr
tips-1099206_00.js
{
    "app": 1,
    "record": 1,
    "order": "desc",
    "offset": 0,
    "limit": 10
}
tips-1099206_01.js
{
    "comments": [
        {
            "id": "2",
            "text": "aki \n确认了,没有问题。\n请继续加油。",
            "createdAt": "2017-11-15T11:54:00Z",
            "creator": {
                "code": "zhou",
                "name": "周世杰"
            },
            "mentions": [
                {
                    "code": "aki",
                    "type": "USER"
                }
            ]
        },
        {
            "id": "1",
            "text": "陈飞 市场部\n这是今天的进展程度。\n周世杰 请确认。",
            "createdAt": "2017-11-15T11:53:00Z",
            "creator": {
                "code": "aki",
                "name": "aki"
            },
            "mentions": [
                {
                    "code": "chenfei",
                    "type": "USER"
                },
                {
                    "code": "市场部",
                    "type": "ORGANIZATION"
                },
                {
                    "code": "zhou",
                    "type": "USER"
                }
            ]
        }
    ],
    "older": false,
    "newer": false
}
tips-1099206_02.js
var body = {
    "app": 1,
    "record": 1001
};

kintone.api(kintone.api.url('/k/v1/record/comments', true), 'GET', body, function(resp) {
    // success
    console.log(resp);
}, function(error) {
    // error
    console.log(error);
});
tips-1099206_03.js
var params = '?app=1&record=1001';
var url = 'https://{subdomain}.cybozu.com/k/v1/record/comments.json' + params;

var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onload = function() {
    if (xhr.status === 200) {
        // success
        console.log(JSON.parse(xhr.responseText));
    } else {
        // error
        console.log(JSON.parse(xhr.responseText));
    }
};
xhr.send();
网友评论