Skip to content

Latest commit

 

History

History
937 lines (654 loc) · 29.9 KB

TemplateApi.md

File metadata and controls

937 lines (654 loc) · 29.9 KB

TemplateApi

All URIs are relative to https://api.hellosign.com/v3

Method HTTP request Description
templateAddUser POST /template/add_user/{template_id} Add User to Template
templateCreate POST /template/create Create Template
templateCreateEmbeddedDraft POST /template/create_embedded_draft Create Embedded Template Draft
templateDelete POST /template/delete/{template_id} Delete Template
templateFiles GET /template/files/{template_id} Get Template Files
templateFilesAsDataUri GET /template/files_as_data_uri/{template_id} Get Template Files as Data Uri
templateFilesAsFileUrl GET /template/files_as_file_url/{template_id} Get Template Files as File Url
templateGet GET /template/{template_id} Get Template
templateList GET /template/list List Templates
templateRemoveUser POST /template/remove_user/{template_id} Remove User from Template
templateUpdateFiles POST /template/update_files/{template_id} Update Template Files

templateAddUser

TemplateGetResponse templateAddUser(templateId, templateAddUserRequest)

Add User to Template

Gives the specified Account access to the specified Template. The specified Account must be a part of your Team.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var data = new TemplateAddUserRequest()
            .emailAddress("george@dropboxsign.com");

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            TemplateGetResponse result = templateApi.templateAddUser(templateId, data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the Template to give the Account access to.
templateAddUserRequest TemplateAddUserRequest

Return type

TemplateGetResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateCreate

TemplateCreateResponse templateCreate(templateCreateRequest)

Create Template

Creates a template that can then be used.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

import java.io.File;
import java.util.List;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var role1 = new SubTemplateRole()
            .name("Client")
            .order(0);

        var role2 = new SubTemplateRole()
            .name("Witness")
            .order(1);

        var mergeField1 = new SubMergeField()
            .name("Full Name")
            .type(SubMergeField.TypeEnum.TEXT);

        var mergeField2 = new SubMergeField()
            .name("Is Registered?")
            .type(SubMergeField.TypeEnum.CHECKBOX);

        var subFieldOptions = new SubFieldOptions()
            .dateFormat(SubFieldOptions.DateFormatEnum.DDMMYYYY);

        var data = new TemplateCreateRequest()
            .clientId("37dee8d8440c66d54cfa05d92c160882")
            .addFilesItem(new File("example_signature_request.pdf"))
            .title("Test Template")
            .subject("Please sign this document")
            .message("For your approval")
            .signerRoles(List.of(role1, role2))
            .ccRoles(List.of("Manager"))
            .mergeFields(List.of(mergeField1, mergeField2))
            .fieldOptions(subFieldOptions)
            .testMode(true);

        try {
            TemplateCreateResponse result = templateApi.templateCreate(data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateCreateRequest TemplateCreateRequest

Return type

TemplateCreateResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateCreateEmbeddedDraft

TemplateCreateEmbeddedDraftResponse templateCreateEmbeddedDraft(templateCreateEmbeddedDraftRequest)

Create Embedded Template Draft

The first step in an embedded template workflow. Creates a draft template that can then be further set up in the template 'edit' stage.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

import java.io.File;
import java.util.List;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var role1 = new SubTemplateRole()
            .name("Client")
            .order(0);

        var role2 = new SubTemplateRole()
            .name("Witness")
            .order(1);

        var mergeField1 = new SubMergeField()
            .name("Full Name")
            .type(SubMergeField.TypeEnum.TEXT);

        var mergeField2 = new SubMergeField()
            .name("Is Registered?")
            .type(SubMergeField.TypeEnum.CHECKBOX);

        var subFieldOptions = new SubFieldOptions()
            .dateFormat(SubFieldOptions.DateFormatEnum.DDMMYYYY);

        var data = new TemplateCreateEmbeddedDraftRequest()
            .clientId("37dee8d8440c66d54cfa05d92c160882")
            .addFilesItem(new File("example_signature_request.pdf"))
            .title("Test Template")
            .subject("Please sign this document")
            .message("For your approval")
            .signerRoles(List.of(role1, role2))
            .ccRoles(List.of("Manager"))
            .mergeFields(List.of(mergeField1, mergeField2))
            .fieldOptions(subFieldOptions)
            .testMode(true);

        try {
            TemplateCreateEmbeddedDraftResponse result = templateApi.templateCreateEmbeddedDraft(data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateCreateEmbeddedDraftRequest TemplateCreateEmbeddedDraftRequest

Return type

TemplateCreateEmbeddedDraftResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateDelete

templateDelete(templateId)

Delete Template

Completely deletes the template specified from the account.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            templateApi.templateDelete(templateId);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the Template to delete.

Return type

null (empty response body)

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateFiles

File templateFiles(templateId, fileType)

Get Template Files

Obtain a copy of the current documents specified by the template_id parameter. Returns a PDF or ZIP file.

If the files are currently being prepared, a status code of 409 will be returned instead. In this case please wait for the template_created callback event.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;

import java.io.File;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            File result = templateApi.templateFiles(templateId, "pdf");
            result.renameTo(new File("file_response.pdf"));
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the template files to retrieve.
fileType String Set to pdf for a single merged document or zip for a collection of individual documents. [optional] [enum: pdf, zip]

Return type

File

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/pdf, application/zip, application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateFilesAsDataUri

FileResponseDataUri templateFilesAsDataUri(templateId)

Get Template Files as Data Uri

Obtain a copy of the current documents specified by the template_id parameter. Returns a JSON object with a data_uri representing the base64 encoded file (PDFs only).

If the files are currently being prepared, a status code of 409 will be returned instead. In this case please wait for the template_created callback event.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            FileResponseDataUri result = templateApi.templateFilesAsDataUri(templateId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the template files to retrieve.

Return type

FileResponseDataUri

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateFilesAsFileUrl

FileResponse templateFilesAsFileUrl(templateId, forceDownload)

Get Template Files as File Url

Obtain a copy of the current documents specified by the template_id parameter. Returns a JSON object with a url to the file (PDFs only).

If the files are currently being prepared, a status code of 409 will be returned instead. In this case please wait for the template_created callback event.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            FileResponse result = templateApi.templateFilesAsFileUrl(templateId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the template files to retrieve.
forceDownload Integer By default when opening the file_url a browser will download the PDF and save it locally. When set to 0 the PDF file will be displayed in the browser. [optional] [default to 1]

Return type

FileResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateGet

TemplateGetResponse templateGet(templateId)

Get Template

Returns the Template specified by the template_id parameter.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var templateId = "f57db65d3f933b5316d398057a36176831451a35";

        try {
            TemplateGetResponse result = templateApi.templateGet(templateId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the Template to retrieve.

Return type

TemplateGetResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateList

TemplateListResponse templateList(accountId, page, pageSize, query)

List Templates

Returns a list of the Templates that are accessible by you.

Take a look at our search guide to learn more about querying templates.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var accountId = "f57db65d3f933b5316d398057a36176831451a35";
        var page = 1;
        var pageSize = 20;
        String query = null;

        try {
            TemplateListResponse result = templateApi.templateList(accountId, page, pageSize, query);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
accountId String Which account to return Templates for. Must be a team member. Use all to indicate all team members. Defaults to your account. [optional]
page Integer Which page number of the Template List to return. Defaults to 1. [optional] [default to 1]
pageSize Integer Number of objects to be returned per page. Must be between 1 and 100. Default is 20. [optional] [default to 20]
query String String that includes search terms and/or fields to be used to filter the Template objects. [optional]

Return type

TemplateListResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateRemoveUser

TemplateGetResponse templateRemoveUser(templateId, templateRemoveUserRequest)

Remove User from Template

Removes the specified Account's access to the specified Template.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var data = new TemplateRemoveUserRequest()
            .emailAddress("george@dropboxsign.com");

        var templateId = "21f920ec2b7f4b6bb64d3ed79f26303843046536";

        try {
            TemplateGetResponse result = templateApi.templateRemoveUser(templateId, data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The id of the Template to remove the Account's access to.
templateRemoveUserRequest TemplateRemoveUserRequest

Return type

TemplateGetResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -

templateUpdateFiles

TemplateUpdateFilesResponse templateUpdateFiles(templateId, templateUpdateFilesRequest)

Update Template Files

Overlays a new file with the overlay of an existing template. The new file(s) must:

  1. have the same or higher page count
  2. the same orientation as the file(s) being replaced.

This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota.

Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks.

It is recommended that a callback be implemented to listen for the callback event. A template_created event will be sent when the files are updated or a template_error event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary.

If the page orientation or page count is different from the original template document, we will notify you with a template_error callback event.

Example

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.model.*;

import java.io.File;

public class Example {
    public static void main(String[] args) {
        var apiClient = Configuration.getDefaultApiClient()
            .setApiKey("YOUR_API_KEY");

        // or, configure Bearer (JWT) authorization: oauth2
        /*
        var apiClient = Configuration.getDefaultApiClient()
            .setBearerToken("YOUR_ACCESS_TOKEN");
        */

        var templateApi = new TemplateApi(apiClient);

        var data = new TemplateUpdateFilesRequest()
            .addFilesItem(new File("example_signature_request.pdf"));

        var templateId = "21f920ec2b7f4b6bb64d3ed79f26303843046536";

        try {
            TemplateUpdateFilesResponse result = templateApi.templateUpdateFiles(templateId, data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountApi#accountCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
templateId String The ID of the template whose files to update.
templateUpdateFilesRequest TemplateUpdateFilesRequest

Return type

TemplateUpdateFilesResponse

Authorization

api_key, oauth2

HTTP request headers

  • Content-Type: application/json, multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 successful operation * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-Ratelimit-Reset -
4XX failed_operation -