Hi,
I’m newbie with DreamFactory, I want to use the REST API to update a table, which have two columns as primaryKey, how can I give the “ids”? I could have misunderstand about the concept…
the table structure is simple:
key1 VARCHAR,
key2 VARCHAR,
value VARCHAR
but don’t have a field named “id”…
the code in Controller:
facDataListDB.update( { ids: { key1: curr_data.key1, key2: curr_data.key2} }, curr_data, function () {
updateByAttr('key1', curr_data.key1,
'key2', curr_data.key2,
curr_data);
}
the factory:
app.factory('facDataListDB', function ($resource) {
var factory = {};
return $resource('/rest/myapp/table/?app_name=myappangular&fields=value',
{},
{
update: { method: 'PUT' },
query: { method: 'GET', isArray: false }
});
});
I got response:
{"error":[{"context":null,"message":"Required id field(s) not valid in request 0: ","code":400}]}
The params from Firebug:
app_name myappangular
fields value
ids {"key1":"491711000000012","key2":"2"}
in Tab “Put” there is correct text for Column “value”…
Thank you very much for the help!
Karl