API: Creation of the contract to be signed

To create a contract, you can use the createContract method of the Contract class.

A quick way to call this method is to use the REST API in the form of an HTTP GET (the preferred solution is to use an HTTP POST):

https://[host]/calinda/hub/selling/model/contract/create?action=createContract&[parameters]
  • Required Parameters

    • date: start date of the transaction (number of ms since Jan 1, 1970)
    • vendor_email: e-mail address of the seller (person who initiates a transaction). Must correspond to a SELL&SIGN user license.
    • customer_number: number of the customer to which the contract is associated (see customer creation step)
    • contract_definition_id: contract template identifier. For a contract without options for which you provide the PDF, use the generic contract template ID in your license (see how to retrieve it in the example in the introduction)
    • closed: use false
    • customer_entity_id: mettre -1
    • keep_on_move: false unless you want to allow the contract to be synchronized and signed in offline mode with tablet using the face-to-face SELL&SIGN application
  • Optional Parameters

    • message_title: the subject of the email sent (for a remote signature with SELL&SIGN). If empty, the default subject is used.
    • message_body: the body of the sent email (excluding headers and footers defined by your license). If empty, the default body is used.
    • filename: the name to use for the signed PDF file.
    • transaction_id: leave empty

Example: 

Return:

https://cloud.sellandsign.com/calinda/hub/selling/model/contract/create?action=createContract&date=1455794147546&vendor_email=amermod%40calindasoftware.com&closed=false&customer_number=AM201603021055&contract_definition_id=1&message_title=&message_body=&filename=&keep_on_move=false&transaction_id=&customer_entity_id=-1&j_token=[your authentication token]
{"id":18758,
"date":1455794147546,
"documentToken":"",
"vendorEmail":"amermod@calindasoftware.com",
"closed":false,
"transactionId":"",
"status":"OPEN",
"customerEntityId":-1,
"contractDefinitionId":1,
"customerNumber":"AM201603021055",
"syncTimer":1456933757841,
"messageTitle":"",
"messageBody":"",
"filename":"",
"keepOnMove":0}

Memorize the ID of the contract returned by this call to use it to load the PDF document and start the signature.

Loading the PDF document to be signed

Generally, the contract template you have designated can generate the PDF contract itself from a sample contract and options.

If you provide the PDF document to be signed, use the contract definition “PDF ADHOC” (the identifier of this contract template in your license can be found using the query presented as an example here)

HTTP POST 

https://[host]/calinda/hub/selling/do?m=uploadContract&id=[contract id]&j_token=[your authentication token]

[Alone with a PDF file in HTTP Part (multipart/form-data)]

Example: 

https://cloud.sellandsign.com/calinda/hub/selling/do?m=uploadContract&id=18758&j_token=[your authentication token]
Content-Length 98094	 	
Content-Type multipart/form-data; 
boundary=---------------------------17051144681837078108139936823737

[le fichier PDF "Devis auto.pdf"]

Return:

{"id":18758,
"date":1455794147546,
"documentToken":"[auto-generated token]",
"vendorEmail":"amermod@calindasoftware.com",
"closed":false,
"transactionId":"",
"status":"OPEN",
"customerEntityId":0,
"contractDefinitionId":1,
"customerNumber":"AM201603021055",
"syncTimer":1456933757841,
"messageTitle":"",
"messageBody":"",
"filename":"Devis auto.pdf",
"keepOnMove":0}

Adding signatories to the contract

It is now sufficient to associate the contract with the signatories defined previously, by specifying their mode of signature.

https://[host]/calinda/hub/selling/model/contractorsforcontract/insert?action=addContractorTo&[parameters]
  • Required parameters

    • contract_id: identifier of the previously retrieved contract
    • contractor_id: signatory ID retrieved when defining it in the previous step
    • signature_mode: signature mode of the signatory:
      • 1: signature by code sent immediately by text message (INSTANT_OTP)
      • 2: Immediate touch signature (INSTANT_PAD)
      • 3: sending an email for a deferred signature by SMS code (MAIL_OTP)
    • signature_status: put the string as “NONE”.
  • Optional parameters

    • signature_id: leave empty
    • signature_date: leave empty

Example:

https://cloud.sellandsign.com/calinda/hub/selling/model/contractorsforcontract/insert?action=addContractorTo&contract_id=18758&contractor_id=11522&signature_mode=2&signature_status=&signature_id=&signature_date=&j_token=[your authentication token]

Return:

{"id":18693,
"contractId":18758,
"contractorId":11522,
"signatureMode":2,
"signatureStatus":"",
"signatureId":"",
"signatureDate":-1,
"lastModificationDate":1456937410346,
"lastModificationPlace":"SERVER"}

Updating of the signature mode

It is necessary to know the signatory’s identifier on the contract (ID of the returned item), and make the following call in POST.

https://[host]/calinda/hub/selling/do?m=changeSignatureMode&[parameters]

Required parameters

  • cfc_id: signatory identifier on the contract
  • rank: order of the signatory
  • mode: mode of signature of the signatory:
    • 1: signature by code sent immediately by text message (INSTANT_OTP)
    • 2: Immediate touch signature (INSTANT_PAD)
    • 3: sending an email for a deferred signature by SMS code (MAIL_OTP)

    Example:

    https://cloud.sellandsign.com/calinda/hub/selling/do?m=changeSignatureMode&cfc_id=[cfc_id]&rank=1&mode=2&j_token=[your authentication token]

    Return:

    {"Succeed":true}

    Signing of the contract

    Once the contract is ready to be signed, it should be submitted for ratification using the contractReady call:

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

    In particular, this will cause the email to be sent for signature if certain signatories are set up for remote signature (MAIL+OTP). It will also make the contract available on a tablet at the next synchronization, if signatories are face-to-face and the “ keep_on_move “ attribute is set on the transaction.

    In the event of an HTTP error

    An HTTP 400 error can indicate the lack of an attribute with an inappropriate value. In case of an HTTP 500 error, you can contact support here: https://support.sellandsign.com/portal/en/home by inserting a request in the ticket.