Kei*_*son 2 filemaker sails.js
我刚刚开始使用sails-filemaker与文件制作服务器通信.我喜欢它:-)我正在寻找一种方法来处理HTML PUT请求来更新记录.
模型是
/**
* LocalityFilemaker.js
*
* @description :: Suburbs (locality) in the evolution database.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
connection: 'filemaker',
tableName: 'locality-sails-layout',
attributes: {
id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
},
suburb: {
type: 'string'
},
state: {
type: 'string'
},
postcode: {
type: 'string'
}
}
};
Run Code Online (Sandbox Code Playgroud)
当我打电话给{{url}}/localityFilemaker/12600时,我得到了回复.
{
"id": 12600,
"suburb": "LARGS BAY",
"state": "SA",
"postcode": "5016",
"modid": "3",
"recid": "29500",
"createdAt": "1970-01-01T00:00:00.000Z",
"updatedAt": "1970-01-01T00:00:00.000Z"
}
Run Code Online (Sandbox Code Playgroud)
当我向{{url}}/localityFilemaker/12600或{{url}}/localityFilemaker调用put时
{
"id": 12600,
"suburb": "LARGS BAY.",
"state": "SA",
"postcode": "5016",
"recid": "29500"
}
Run Code Online (Sandbox Code Playgroud)
我收到400 Bad请求.使用PUT HTML请求使用sails-filemaker更新记录的最佳方法是什么?
如果我错了,我希望托德会纠正我.看起来"recid"是一个FileMaker内部记录ID,你的put正在尝试更新它.从你的put JSON中删除"recid",它应该可以工作.