Suggested Workflow for eSign API Integrations
Suggested workflow
For all the following workflow steps, keep in mind that our API expects you to behave like an HTML form, i.e., the POST bodies shall not contain raw JSON, but be structured like a form where the document JSON is most often specified as 'document': {"my": "json", [...]}. I use this Python:
postdata = urllib.urlencode({'document': postdata})
- POST /api/v2/documents/newfromtemplate/{document_id} -> The document ID in this call is the ID of a template document. When called, Scrive responds with JSON that contains a new and unique document ID. This ID is used in the following steps.
- POST /api/v2/documents/{document_id}/update with amended JSON, such as any user data that you want to enter into fields in the template document, as well as "delivery_method": "api" and "api_callback_url": "https://yoururl/" as well as "sign_success_redirect_url": "https://landingpage/" unless you have already set those in the template. Scrive responds with the updated JSON.
- POST /api/v2/documents/{document_id}/start -> Scrive responds with JSON again and starts the signing process. As you have selected "delivery_method": "api" you should extract api_delivery_url from the JSON. This is a URI relative to https://api-testbed.scrive.com/ where the end user should be redirected to sign the document.
- Redirect the user’s browser to the API delivery URL.
- The end user signs the document.
- The end user is redirected back to sign_success_redirect_url by Scrive.
- Once you receive a call from Scrive to the callback URL with document_signed_and_sealed: true, (see API documentation) you can download the document using GET /api/v2/documents/{document_id}/files/main/{filename} (file name is whatever you want the downloaded file to be named).
Authentication
To find/generate your tokens, log into your account at Scrive.com, from the top menu click Account, and then click Integration settings. I suggest you do not implement the OAUTH workflow as you already have all tokens. Just concatenate consumer_secret and oauth_token_secret, separated by "&" and use it as the signature.
See the curl example on the right panel of the API documentation, or these two lines of Python:
signature = “%s&%s” % (CONSUMER_SECRET, OAUTH_TOKEN_SECRET)
headers = {"Authorization": 'OAuth, oauth_signature_method="PLAINTEXT", oauth_consumer_key="%s", oauth_token="%s",oauth_signature="%s"' % (CONSUMER_KEY, OAUTH_TOKEN, signature)}
Questions?
Contact integrations@scrive.com for further assistance during your integration.