Skip to content

DocSpring/docspring-csharp

Repository files navigation

DocSpring.Client - the C# library for the API v1

DocSpring is a service that helps you fill out and sign PDF templates.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • SDK version: 2.0.0
  • Generator version: 7.11.0
  • Build package: com.docspring.codegen.DocSpringCSharpClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using DocSpring.Client.Api;
using DocSpring.Client.Client;
using DocSpring.Client.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using DocSpring.Client.Api;
using DocSpring.Client.Client;
using DocSpring.Client.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.docspring.com/api/v1";
            // Configure HTTP basic authorization: api_token_basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";

            var apiInstance = new PDFApi(config);
            var templateId = tpl_000000000000000002;  // string | 
            var data = new AddFieldsData(); // AddFieldsData | 

            try
            {
                // Add new fields to a Template
                AddFieldsTemplateResponse result = apiInstance.AddFieldsToTemplate(templateId, data);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling PDFApi.AddFieldsToTemplate: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
PDFApi AddFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
PDFApi BatchGeneratePdfV1 POST /templates/{template_id}/submissions/batch Generates multiple PDFs
PDFApi BatchGeneratePdfs POST /submissions/batches Generates multiple PDFs
PDFApi CombinePdfs POST /combined_submissions?v=2 Merge submission PDFs, template PDFs, or custom files
PDFApi CombineSubmissions POST /combined_submissions Merge generated PDFs together
PDFApi CopyTemplate POST /templates/{template_id}/copy Copy a Template
PDFApi CreateCustomFileFromUpload POST /custom_files Create a new custom file from a cached presign upload
PDFApi CreateDataRequestEvent POST /data_requests/{data_request_id}/events Creates a new event for emailing a signee a request for signature
PDFApi CreateDataRequestToken POST /data_requests/{data_request_id}/tokens Creates a new data request token for form authentication
PDFApi CreateFolder POST /folders/ Create a folder
PDFApi CreateHTMLTemplate POST /templates?desc=html Create a new HTML template
PDFApi CreatePDFTemplate POST /templates Create a new PDF template with a form POST file upload
PDFApi CreatePDFTemplateFromUpload POST /templates?desc=cached_upload Create a new PDF template from a cached presign upload
PDFApi DeleteFolder DELETE /folders/{folder_id} Delete a folder
PDFApi DeleteTemplate DELETE /templates/{template_id} Delete a template
PDFApi ExpireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
PDFApi ExpireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
PDFApi GeneratePDF POST /templates/{template_id}/submissions Generates a new PDF
PDFApi GeneratePreview POST /submissions/{submission_id}/generate_preview Generated a preview PDF for partially completed data requests
PDFApi GetCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
PDFApi GetDataRequest GET /data_requests/{data_request_id} Look up a submission data request
PDFApi GetFullTemplate GET /templates/{template_id}?full=true Fetch the full template attributes
PDFApi GetPresignUrl GET /uploads/presign Get a presigned URL so that you can upload a file to our AWS S3 bucket
PDFApi GetSubmission GET /submissions/{submission_id} Check the status of a PDF
PDFApi GetSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
PDFApi GetTemplate GET /templates/{template_id} Check the status of an uploaded template
PDFApi GetTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
PDFApi ListCombinedSubmissions GET /combined_submissions Get a list of all combined submissions
PDFApi ListFolders GET /folders/ Get a list of all folders
PDFApi ListSubmissions GET /submissions List all submissions
PDFApi ListTemplateSubmissions GET /templates/{template_id}/submissions List all submissions for a given template
PDFApi ListTemplates GET /templates Get a list of all templates
PDFApi MoveFolderToFolder POST /folders/{folder_id}/move Move a folder
PDFApi MoveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
PDFApi PublishTemplateVersion POST /templates/{template_id}/publish_version Publish a template version
PDFApi RenameFolder POST /folders/{folder_id}/rename Rename a folder
PDFApi RestoreTemplateVersion POST /templates/{template_id}/restore_version Restore a template version
PDFApi TestAuthentication GET /authentication Test Authentication
PDFApi UpdateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
PDFApi UpdateTemplate PUT /templates/{template_id} Update a Template

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_token_basic

  • Type: HTTP basic authentication