我有2个型号。我想联想2个模特。
Manufacturers.js
module.exports = {
attributes: {
manufacturer_name: {
type: 'string'
},
manufacturer_logo_url: {
type: 'string'
},
manufacturer_archived_status: {
type: 'boolean'
},
manufacturer_tabs: {
model: 'manufacturer_tabs'
}
}
};
Manufacturer_tabs.js
module.exports = {
attributes: {
tab_name: {
type: 'string'
},
manufacturer_fields: {
model: 'manufacturer_fields'
}
}
};
当我尝试在制造商中创建标签时添加制造商后,我收到404错误。
POST http://localhost:1337/manufacturers/5acf62cf080d700c2209d40b/manufacturer_tabs
POST Body
{
"tab_name": "tab1"
}
我正在使用蓝图POST /:model/:id/:association/
答案 0 :(得分:0)
您必须在风帆v1.0中提供fk
ID,蓝图路线为:PUT /:model/:id/:association/:fk
请参阅here,manufacturer_tabs
记录必须已在数据库中,这就是您必须提供其ID fk
的原因。