REST: DB update with more than one primaryKey


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:


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,

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!



Hey - this is Mark with Dreamfactory Support. I wanted to reach out to you and give you a few hints, because you are just beginning with the DSP.

First, give this a try using the API_DOCs (Swagger) feature within the launchpad. Once you do this, I think you’ll get a better understanding of our system specifically, though the JSON doesn’t change… as you would expect.

So, your original question was how to give an id. This is done via the schema - basically, it serves as an infrastructure for the data that you plan to input. You can do this through the Live API, or you’re able to go into the schema and add through there.

Normally, this is the primary ID for each table but doesn’t necessarily have to be. It’s just a common way to create the rbdms - using primary keys. See if you can go ahead and add that field (as primary), so that we’re able to at least get these relationships defined and the query back successfully.


  • Mark


I haven’t gotten a response from you, so want to think that everything is working out. Were you able to establish the relationship between the two tables and figure out your primary keys?

Hi Mark,

I’ve used the following the URL in resource:
And give a data, which has KEY1, KEY2 and target Value, then the update works…

That’s why I think it’s df special thing, because of app_name, id_field, but maybe is there other simply way?