use std::error::Error;
fn main() {
match authenticate() {
Ok(()) => (),
Err(error) => eprintln!("{}", error),
}
}
fn authenticate() -> Result<(), Box<dyn Error>> {
let session = create_session("ds_123456789");
Ok(())
}Docs
Rust
Rust
Learn how to create your first sigature request using the DigiSign Rust SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
Install
Get the DigiSign Rust SDK.
[dependencies]
digisign-rust-sdk = "lastest"Authenticate
The DigiSign API requires authentication via an API Key. Learn More.
Call create_session to authenticate. Each session expires every 6 minutes.
Transform a template to a Request
The easiest way to create a request is by using the transform method.
use std::error::Error;
fn main() {
match create_request() {
Ok(()) => (),
Err(error) => eprintln!("{}", error),
}
}
fn create_request() -> Result<(), Box<dyn Error>> {
let session = create_session("ds_123456789");
let workspace_id = "ws_1234567890";
let data = serde_json::json!({
"recipients": [
{
"id": "tmp-ee55621f-ab34-4d61-b10e-c89b33464d5a",
"name": "Simeon Akpanudo",
"email": "levine.cmion@gmail.com",
"fillable": {
"company": "Jide & Sons Limited",
"company_2": "Emeka International Limited",
"first_name": "Jidenna Ifeanyi",
"last_name": "Okonkwo"
},
"private_message": "Jide, please check this document ASAP, for your container. This is just a test document tho. Good testing!!!"
}
],
"message": {
"subject": "Avocado Replublic Export v1.1",
"body": "Please review and sign this document as soon as you can. Thanks"
}
});
session.requests().workspace(workspace_id).transform(data)?;
Ok(())
}Recipients ID must match a corresponding alias ID from the selected template.
Try it yourself
Was this page helpful?