I have an Oracle ADF Application which has a master-detail structure. My application works fine, but when I am inserting a master-detail record, my detail object is not being displayed in the response but in a link.
So, how can I make the application display the detail info along with master. My request and response are like following. Thanks a lot.
---------------------Request-------------------------------------------------
{
"ChqCode": "value",
"ChqAmt": 1234,
"ChqBankCompCode": "value",
"ChqCompCode": "value",
"PayViewObj":[
{
"PaCompCode": "value",
"PaChqCompCode": "value"
}
]
}
-------------------------Response--------------------------
{
"ChqCode": "value",
"ChqAmt": 1234,
"ChqBankCompCode": "value",
"ChqCompCode": "value",
"links": [
{
"rel": "self",
"href": "http://127.0.0.1:7101/ap-rest-api/rest/1/manualcheck/5100",
"name": "manualcheck",
"kind": "item"
},
{
"rel": "canonical",
"href": "http://127.0.0.1:7101/ap-rest-api/rest/1/manualcheck/5100",
"name": "manualcheck",
"kind": "item"
},
{
"rel": "child",
"href": "http://127.0.0.1:7101/ap-rest-api/rest/1/manualcheck/5100/child/PayViewObj",
"name": "PayViewObj",
"kind": "collection"
}
]
}
This is not possible. It's a limitation from ADF framework. Upon POST, once a record is inserted it performs a GET (alike operation) on the inserted record and delivers the same as response payload for your POST.
For your POST operation, the response payload is a confirmation of the data inserted.
To ensure your insert is successful you should rely on the response status 201. But validation of data POSTed is best done using a successive GET operation. In which case you can additionally get the child resources from the links.