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

填写记录的回复

来源:互联网 收集:自由互联 发布时间:2021-06-28
api-1099207_00.js { "app": 12343, "record": 4, "comment": { "text": "来自应用管理员的通知。\n请确认。", "mentions": [ { "code": "zhou", "type": "USER" }, { "code": "市场部", "type": "ORGANIZATION" }, { "code": "devnet运营组
api-1099207_00.js
{
    "app": 12343,
    "record": 4,
    "comment": {
        "text": "来自应用管理员的通知。\n请确认。",
        "mentions": [
            {
                "code": "zhou",
                "type": "USER"
            },
            {
                "code": "市场部",
                "type": "ORGANIZATION"
            },
            {
                "code": "devnet运营组",
                "type": "GROUP"
            }
        ]
    }
}
api-1099207_01.js
{
    "id": 3
}
api-1099207_02.js
var body = {
    "app": 1,
    "record": 1001,
    "comment": {
        "text": "来自应用管理员的通知。\n请确认。",
        "mentions": [
            {
                "code": "zhou",
                "type": "USER"
            },
            {
                "code": "市场部",
                "type": "ORGANIZATION"
            },
            {
                "code": "devnet运营部",
                "type": "GROUP"
            }
        ]
    }
}
kintone.api(kintone.api.url('/k/v1/record/comment', true), 'POST', body, function(resp) {
    //success
    console.log(resp);
}, function(error) {
    //error
    console.log(error);
});
api-1099207_03.js
var body = {
    "app": 1,
    "record": 1001,
    "comment": {
        "text": "来自应用管理员的通知。\n请确认。",
        "mentions": [
            {
                "code": "zhou",
                "type": "USER"
            },
            {
                "code": "市场部",
                "type": "ORGANIZATION"
            },
            {
                "code": "devnet运营组",
                "type": "GROUP"
            }
        ]
    },
    // CSRF TOKEN: 在kintone执行API(POST, PUT, DELETE)时需要设置
    "__REQUEST_TOKEN__": kintone.getRequestToken()
};

var url = 'https://{subdomain}.cybozu.com/k/v1/record/comment.json';
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function() {
    if (xhr.status === 200) {
        // success
        console.log(JSON.parse(xhr.responseText));
    } else {
        // error
        console.log(JSON.parse(xhr.responseText));
    }
};
xhr.send(JSON.stringify(body));
上一篇:身份证号码验证
下一篇:ajax 上传文件
网友评论