Updating a document
Once a document has been created, you may want to update it with relevant information. This could for example be the names of the signing parties, email addresses for delivery and similar. The information you wish to update the document with should be supplied using url-encoded formdata where the key is named “document” and the value is the JSON:
document={“your”:”json”,”goes”:”here”}
Send this data as a POST request to /api/v2/documents/{document_id}/update
Read more about this API call in our documentation
To get started, see the code examples below which may help you.
Python
import requests
url = "https://api-testbed.scrive.com/api/v2/documents/8222115557376890778/update"
payload='document=%7B%22title%22%3A%22agreement%22%7D'
headers = {
'Authorization': 'oauth_signature_method="PLAINTEXT", oauth_consumer_key="YOUR_TOKEN", oauth_token="YOUR_TOKEN", oauth_signature="YOUR_TOKEN&YOUR_TOKEN"',
'Content-Type': 'application/x-www-form-urlencoded',
'Cookie': 'lang="en"; lang-ssn="en"'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
C#
var client = new RestClient("https://api-testbed.scrive.com/api/v2/documents/8222115557376890778/update");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"YOUR_TOKEN\", oauth_token=\"YOUR_TOKEN\", oauth_signature=\"YOUR_TOKEN&YOUR_TOKEN\"");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Cookie", "lang=\"en\"; lang-ssn=\"en\"");
request.AddParameter("document", "{\"title\":\"agreement\"}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
JavaScript
var myHeaders = new Headers();
myHeaders.append("Authorization", "oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\"YOUR_TOKEN\", oauth_token=\"YOUR_TOKEN\", oauth_signature=\"YOUR_TOKEN&YOUR_TOKEN\"");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
myHeaders.append("Cookie", "lang=\"en\"; lang-ssn=\"en\"");
var urlencoded = new URLSearchParams();
urlencoded.append("document", "{\"title\":\"agreement\"}");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://api-testbed.scrive.com/api/v2/documents/8222115557376890778/update", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
PHP
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://api-testbed.scrive.com/api/v2/documents/8222115557376890778/update');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append(new http\QueryString(array(
'document' => '{"title":"agreement"}')));$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Authorization' => 'oauth_signature_method="PLAINTEXT", oauth_consumer_key="YOUR_TOKEN", oauth_token="YOUR_TOKEN", oauth_signature="YOUR_TOKEN&YOUR_TOKEN"',
'Content-Type' => 'application/x-www-form-urlencoded',
'Cookie' => 'lang="en"; lang-ssn="en"'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();