Hello,
We are consuming our client’s API (base on Tryton), but there custom modules are not documented. I would like if know if there any possible optimisation in the folowing calls:
the need: given a party_id, we need to fin all the covered_elements data related to the party contracts.
Current solution:
Call 1: {{WEB_URL}}/party/89/?_fields=contracts
Result:
{
"_": "party.party",
"id": 89,
"siren": null,
"ssn": "123",
"death_date": null,
"forced_claim_bank_account": {
"_": "bank.account",
"id": null
},
"gender": "female",
"commercial_name": null,
"contracts": [
{
"_": "contract",
"id": 121253,
"signature_date": "2020-10-02",
"subscriber": {
"_": "party.party",
"id": 89
},
"rec_name": "CT8901"
}
]
}
Call 2: {{WEB_URL}}/contract/121253/?_fields= covered_elements
Result:
{
"_": "contract",
"id": 121253,
"signature_date": "2020-10-02",
"contract_number": "CT8901",
"covered_elements": [
{
"_": "contract.covered_element",
"id": 79221,
"write_date": "2022-08-23 19:17:42.174",
"party": {
"_": "party.party",
"id": 89
},
{
"_": "contract.covered_element",
"id": 79222,
"write_date": "2022-08-23 19:19:27.114",
"party": {
"_": "party.party",
"id": 90
},
}
],
}
The question: is there any way to reach Contract.covered_elements directly from the 1st call ?
something like:
{{WEB_URL}}/party/89 /?_fields=contracts,contracts.covered_elements
{{WEB_URL}}/party/89 /?_fields=contracts,contracts:covered_elements
…
Needed result:
{
"_": "party.party",
"id": 89,
"siren": null,
"ssn": "123",
"death_date": null,
"forced_claim_bank_account": {
"_": "bank.account",
"id": null
},
"gender": "female",
"commercial_name": null,
"contracts": [
{
"_": "contract",
"id": 121253,
"signature_date": "2020-10-02",
"subscriber": {
"_": "party.party",
"id": 89
},
"rec_name": "CT8901",
"covered_elements": [
{
"_": "contract.covered_element",
"id": 79221,
"write_date": "2022-08-23 19:17:42.174",
"party": {
"_": "party.party",
"id": 89
},
{
"_": "contract.covered_element",
"id": 79222,
"write_date": "2022-08-23 19:19:27.114",
"party": {
"_": "party.party",
"id": 90
},
}
],
}
]
}
Thanks.