API: Retrieving the result of the transaction

Once the transaction has been completed, it is easy to find the result and access all related details and documents.

Retrieving contract information:

https://[host]/calinda/hub/selling/model/contract/read?action=getContract&contract_id=[contract id]

Result (contract that was signed remotely by email, thats subject and body can be found here):

There you go! The contract and all its documents are now available in your SELL&SIGN Backoffice.

It is also easy to retrieve the elements related to the contract via API.

Retrieving the signed document

https://[host]/calinda/hub/selling/do?m=getSignedContract&contract_id=[id du contrat]
{"id":18827, // contract id
"date":1456299951109,
"documentToken":"MtqsdfssMDA3OTQ3MF8xODA1Ml84MTA1OTYu003d",
"vendorEmail":"vendor@yourcompany.com",
"closed":true,
"transactionId":"2c969e2b52a819ad01531240f5bf7b38", 
// transaction id at our trusted third party
"status":"ARCHIVED",
"customerEntityId":0,
"contractDefinitionId":86,
"customerNumber":"4xNDU2Mjk5MjYyMzU1LjU1OTQw",
"syncTimer":1456762870396,
"messageTitle":"Sellu0026Sign remote proposal",
"messageBody":"Hello,u003cbr/u003eu003cbr/u003eAs agreed, here is my proposal in order to tool up your team with 6 Sellu0026Sign remote licenses .u003cbr/u003eu003cbr/u003eYou can sign this proposal by clicking on the button "sign the document" below.u003cbr/u003eu003cbr/u003eBest regards,u003cbr/u003eu003cbr/u003e",
"filename":"Proposal_SellSign_1.0_240216.pdf",
"keepOnMove":0}

The result is a binary file of application/pdf content type. If the contract is not yet ready, the server may return a 500 error with a message stating that the contract is not yet available.

Retrieving the PDF document regardless of the status of the contract

https://[host]/calinda/hub/selling/do?m=getCurrentDocumentForContract&id=[contract id]

The result is a binary file of application/pdf content type.

Retrieving the evidence file:

https://[host]/calinda/hub/selling/do?m=getEvidences&contract_id=[contract id]

The result is a binary file of application/zip content type. If the evidence file is not yet available, a 500 error is returned with a status message.
The structure of the zip file is as follows:
/pdf file
/xml file of proofs
/document/attachment 1
/document/attachment …
/document/ json file containing the information collected on the mobile equipment that generated the contract if it was performed  in ‘offline’ mode.

Retrieving contract attachments
First, list the attachments for a contract

https://[host]/calinda/hub/selling/model/picture/list?action=getPicturesForContract&contract_id=[contract id]

There is a list of attachments as a result:

{
    "elements": [{
        "id": 15,
        "optionId": 603,
        "lastModificationDate": 1468240073319,
        "imageToken": "MTQ2ODI0MDA3MzMwMF82MDNfNTIxNDY=",
        "lastModificationPlace": "SERVER",
        "name": "B61jolYIQAANbJv.png",
        "contentType": "image/png"
    }, {
        "id": 14,
        "optionId": 603,
        "lastModificationDate": 1468240070442,
        "imageToken": "MTQ2ODI0MDA3MDQzMl82MDNfOTY4MzYw",
        "lastModificationPlace": "SERVER",
        "name": "Milkyway-and-Earth_www.FullHDWpp.com_.jpg",
        "contentType": "image/jpeg"
    }],
    "totalSize": 2
}

From the ‘imageToken’ attribute, it is possible to download the content by calling:

https://[host]/calinda/hub/selling/do?m=loadPicture&image_token=[the imageToken extracted from the list above]

The result is a binary file of the content type corresponding to the attachment (this information can also be found in the list obtained earlier)

Retrieving the signature status of a contract

https://[host]/calinda/hub/selling/model/contractorsforcontract/list?action=getContractorsAbout&contract_id=[contract id]&offset=[list position]&size=[list size]

This method allows you to browse through the list of signatories, so you will need to specify an offset and size to define your returned sub-list.
The result is a status list of contract signatures in the form:

{
    "elements": [{
        "id": 941,
        "contractId": 1168,
        "contractorId": 281,  //signer id
        "signatureMode": 2,
        "signatureStatus": "SIGNED", // signature status
        "signatureId": "33882819",
        "signatureDate": 1477673562987,  // UTC date time in milliseconds since 01/01/1970
        "lastModificationDate": 1477673551721,
        "lastModificationPlace": "SERVER"
    }],
    "totalSize": 1
}