Skip to content

DocSpring/docspring-java

Repository files navigation

DocSpring

DocSpring API

  • API version: v1

  • Generator version: 7.16.0-DOCSPRING

Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven (3.8.3+)/Gradle (7.2+)

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.docspring</groupId>
  <artifactId>DocSpring</artifactId>
  <version>3.0.1</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'DocSpring' jar has been published to maven central.
    mavenLocal()       // Needed if the 'DocSpring' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.docspring:DocSpring:3.0.1"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/DocSpring-3.0.1.jar
  • target/lib/*.jar

Usage

To add a HTTP proxy for the API client, use ClientConfig:

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import com.docspring.*;
import com.docspring.Client;

...

ApiClient defaultClient = Configuration.getDefaultApiClient();
ClientConfig clientConfig = defaultClient.getClientConfig();
clientConfig.connectorProvider(new ApacheConnectorProvider());
clientConfig.property(ClientProperties.PROXY_URI, "http://proxy_url_here");
clientConfig.property(ClientProperties.PROXY_USERNAME, "proxy_username");
clientConfig.property(ClientProperties.PROXY_PASSWORD, "proxy_password");
defaultClient.setClientConfig(clientConfig);

Client apiInstance = new Client(defaultClient);

Getting Started

Please follow the installation instruction and execute the following Java code:

import com.docspring.*;
import com.docspring.auth.*;
import com.docspring.*;
import com.docspring.Client;

public class ClientExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://sync.api.docspring.com/api/v1");
        
        // Configure HTTP basic authorization: api_token_basic
        HttpBasicAuth api_token_basic = (HttpBasicAuth) defaultClient.getAuthentication("api_token_basic");
        api_token_basic.setUsername("YOUR USERNAME");
        api_token_basic.setPassword("YOUR PASSWORD");

        Client apiInstance = new Client(defaultClient);
        String templateId = "tpl_1234567890abcdef02"; // String | 
        AddFieldsData data = new AddFieldsData(); // AddFieldsData | 
        try {
            TemplateAddFieldsResponse result = apiInstance.addFieldsToTemplate(templateId, data);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling Client#addFieldsToTemplate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://sync.api.docspring.com/api/v1

Class Method HTTP request Description
Client addFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
Client batchGeneratePdfs POST /submissions/batches Generate multiple PDFs
Client combinePdfs POST /combined_submissions Merge submission PDFs, template PDFs, or custom files
Client copyTemplate POST /templates/{template_id}/copy Copy a template
Client createCustomFileFromUpload POST /custom_files Create a new custom file from a cached S3 upload
Client createDataRequestEvent POST /data_requests/{data_request_id}/events Create a new event for emailing a signee a request for signature
Client createDataRequestToken POST /data_requests/{data_request_id}/tokens Create a new data request token for form authentication
Client createFolder POST /folders/ Create a folder
Client createHtmlTemplate POST /templates?endpoint_variant=create_html_template Create a new HTML template
Client createPdfTemplate POST /templates Create a new PDF template with a form POST file upload
Client createPdfTemplateFromUpload POST /templates?endpoint_variant=create_template_from_cached_upload Create a new PDF template from a cached S3 file upload
Client deleteFolder DELETE /folders/{folder_id} Delete a folder
Client deleteTemplate DELETE /templates/{template_id} Delete a template
Client expireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
Client expireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
Client generatePdf POST /templates/{template_id}/submissions Generate a PDF
Client generatePreview POST /submissions/{submission_id}/generate_preview Generate a preview PDF for partially completed data requests
Client getCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
Client getDataRequest GET /data_requests/{data_request_id} Look up a submission data request
Client getFullTemplate GET /templates/{template_id}?full=true Fetch the full attributes for a PDF template
Client getPresignUrl GET /uploads/presign Get a presigned S3 URL for direct file upload
Client getSubmission GET /submissions/{submission_id} Check the status of a PDF
Client getSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
Client getTemplate GET /templates/{template_id} Check the status of an uploaded template
Client getTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
Client listCombinedSubmissions GET /combined_submissions Get a list of all combined submissions
Client listFolders GET /folders/ Get a list of all folders
Client listSubmissions GET /submissions List all submissions
Client listTemplateSubmissions GET /templates/{template_id}/submissions List all submissions for a given template
Client listTemplates GET /templates Get a list of all templates
Client moveFolderToFolder POST /folders/{folder_id}/move Move a folder
Client moveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
Client publishTemplateVersion POST /templates/{template_id}/publish_version Publish a template version
Client renameFolder POST /folders/{folder_id}/rename Rename a folder
Client restoreTemplateVersion POST /templates/{template_id}/restore_version Restore a template version
Client testAuthentication GET /authentication Test authentication
Client updateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
Client updateTemplate PUT /templates/{template_id} Update a Template
Client updateTemplateDocument PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_form_post Update a template's document with a form POST file upload
Client updateTemplateDocumentFromUpload PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_cached_upload Update a template's document with a cached S3 file upload

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_token_basic

  • Type: HTTP basic authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

About

Java API Client for DocSpring

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages