AnsweredAssumed Answered

PUT multiple related records in Data API request

Question asked by kallesamuelsson on Oct 20, 2017
Latest reply on Oct 20, 2017 by beverly

In the documentation (https://fmhelp.filemaker.com/docs/16/en/restapi/#work-with-records_create-record) from FMI

the HTTP-body example for creating records using FMS16 Data API (REST) looks like this

 

{"data": 
    {
    "field_1": "value_1",
    "field_2": "value_2",
    "repetitionField(1)" : "fieldValue",
    "Orders::OrderDate.0":"12/22/2015"
    }
}

 

The last attribute Orders::OrderDate.0 sets a value to a field on a related record and since the record don´t already exist it will be created.

 

My question focus on the .0 suffix of the attribute name. It looks to me like the 0 indicates a serial/identifier for on which related record the value should be inserted. This leads me to wonder if it is possible to create more then one related record in the same request that creates the parent record.

 

The below body returns an error that the record does not exist, so why can one related record be created but not two?

 

{"data": 
    {
    "field_1": "value_1",
    "field_2": "value_2",
    "repetitionField(1)" : "fieldValue",
    "Orders::OrderDate.0":"12/22/2015",
    "Orders::OrderDate.1":"11/11/2011"
    }
}

 

Any clue if the above body should work? Am I missing something?

 

I am fully aware that I can (should) post several requests aimed at the related tables layout to create the related records. I just wish to know, since the .0 notation is in the documentation, does it have a valid function?

Outcomes