Dropbox Forms API v3 contains several API calls for authentication and workflows. Here are examples of these API requests in C#.NET. These examples use the RestSharp request library.
For more information on these endpoints, please refer to the API Documentation.
Get Auth Token
public static String getAuthToken()
{
var client = new RestClient();
client.BaseUrl = new Uri("https://api.helloworks.com/v3");
var request = new RestRequest("https://api.helloworks.com/v3/token/[API_KEY_ID]", Method.GET)
.AddHeader("Authorization", "Bearer[API KEY]");
var response = client.Execute(request);
var data = response.Content;
Console.WriteLine(data);
}
Create Workflow Instance
{
var client = new RestClient();
client.BaseUrl = new Uri("https://api.helloworks.com/v3");
String authToken = "Bearer: " + getAuthToken();
var request = new RestRequest("https://api.helloworks.com/v3/workflow_instances",Method.POST)
.AddHeader("Authorization", authToken)
.AddParameter("workflow_id", [WORKFLOW ID])
.AddParameter("participants[signer][type]", "email")
.AddParameter("participants[signer][value]", "helloworks@example.com")
.AddParameter("participants[signer][full_name]", "HelloWorks Signer");
var response = client.Execute(request);
Console.WriteLine(response.Content);
}
Get Workflow Instance
public static void getInstance()
{
var client = new RestClient();
client.BaseUrl = new Uri("https://api.helloworks.com/v3");
String authToken = "Bearer: " + getAuthToken();
var request = new RestRequest("https://api.helloworks.com/v3/workflow_instances/[WORKFLOW INSTANCE ID]", Method.GET)
.AddHeader("Authorization", authToken);
var response = client.Execute(request);
Console.WriteLine(response.Content);
}
Get Workflow Instance Audit Trail
public static void getAuditTrail()
{
var client = new RestClient();
client.BaseUrl = new Uri("https://api.helloworks.com/v3");
String authToken = "Bearer: " + getAuthToken();
var request = new RestRequest("https://api.helloworks.com/v3/workflow_instances/[WORKFLOW INSTANCE ID/audit_trail", Method.GET)
.AddHeader("Authorization", authToken)
.AddHeader("Accept", "application/pdf");
byte[] response = client.DownloadData(request);
File.WriteAllBytes("HW-Audit-Trail.pdf", response);
}
Get Workflow Instance Documents
public static void getDocument()
{
var client = new RestClient();
client.BaseUrl = new Uri("https://api.helloworks.com/v3");
String authToken = "Bearer: " + getAuthToken();
var request = new RestRequest("https://api.helloworks.com/v3/workflow_instances/[WORKFLOW INSTANCE ID/documents/[DOCUMENT ID]", Method.GET)
.AddHeader("Authorization", authToken)
.AddHeader("Accept", "application/pdf");
byte[] response = client.DownloadData(request);
File.WriteAllBytes("HW-Document.pdf", response);
}
Comments
0 comments
Article is closed for comments.