当我尝试使用实体api更新dialogflow中的实体列表时,整个列表将被覆盖,我丢失了旧记录。 我该如何处理这个问题?
以下是我在项目中执行的api调用:
var request = require("request");
var url = "https://api.dialogflow.com/v1/entities/b56efdf4-09c8-402e-96ee-8185ef4c0a5b";
var send_id;
var send_name;
//channel
var auth_token = "Bearer dev_token";
var headers = {
"Authorization": auth_token,
"Content-Type" : "application/json"
}
var body = {
"automatedExpansion":true ,
"isOverridable":false,
"entries": [
{
"synonyms": [name] ,
"value": channel_name
}
],
"name":"new"
}
request.put({
"url": url,
"headers": headers,
"body": JSON.stringify(body)
}, (err, response, body) => {
if (err) {
reject(err);
}
///resolve(JSON.parse(response.body));
console.log("response: "+ response.body);
});