How to link a invoice with a contract using the AP

Hello,
I’m developing an order/contract module in a web site and I need to send the contract to Dolibarr. I want to create a contract and its lines using the API, then validate the contract and then create an invoice linked with the contract. I have succeed in creating both using the API but I can’t link them.
Thanks in advance.

When you create or update the contract or invoice, try to fill the array linkedObjectsIds

Thanks for your answer. I’ve tried to modify the linkedobjectID, but I haven’t succeed in finding the right syntax. I’ve seen in the data sent by the API
‘linkedObjectsIds’ =>
array (
‘contrat’ =>
array (
7 => ‘3’,
),
),

but I don’t understand what 7 means.
Regards

The 7 is in the database the link id between the contract and the invoice.

I have created via API, the link between the contract and the invoice with:
invoice[‘linkedObjectsIds’][‘contrat’] = contractId
I hope that helps

The 7 is in the database the link id between the contract and the invoice.

I have created via API, the link between the contract and the invoice with:

invoice['linkedObjectsIds']['contrat'] = contractId

I hope that helps

PS. Some texts got interpreted by bbcode