C#: Acrobat Sign SDK

The Acrobat Sign SDK supports integrating the Acrobat Sign RESTful web service into client applications via easy-to-consume client side objects wrapping the REST API functionality. This repository contains Acrobat Sign’s SDK (CSharp) and samples for these APIs.

This C# SDK is automatically generated by Swagger Codegen:

  • API version: 6.0.0

  • SDK version: 1.0.0

  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

Supported Frameworks

  • .NET 4.0 or later

  • Windows Phone 7.1 (Mango)

Third Party 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

Note

RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL:

  • Mac/Linux: /bin/sh build.sh

  • Windows: build.bat

The IO.Swagger.dll will be generated at <AdobeSignCSharpSDK>/bin.

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

csharp
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.model.agreements;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out IO.Swagger.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.model.agreements;

namespace Example


{
    public class Example
    {
        public void main()
        {

            var apiInstance = new AgreementsApi();
            var authorization = authorization_example;  // string | An OAuth Access Token with scopes: 'agreement_write' in the format 'Bearer {accessToken}'.
            var ifMatch = ifMatch_example;  // string | The server will only update the resource if it matches the listed ETag otherwise error RESOURCE_MODIFIED(412) is returned.
            var agreementId = agreementId_example;  // string | The agreement identifier, as returned by the agreement creation API or retrieved from the API to fetch agreements.
            var formFieldPostInfo = new FormFieldPostInfo(); // FormFieldPostInfo | List of form fields to add or replace
            var xApiUser = xApiUser_example;  // string | The userId or email of API caller using the account or group token in the format <b>userid:{userId} OR email:{email}.</b> If it is not specified, then the caller is inferred from the token. (optional)
            var xOnBehalfOfUser = xOnBehalfOfUser_example;  // string | The userId or email in the format <b>userid:{userId} OR email:{email}.</b> of the user that has shared his/her account (optional)

            try
            {
                // Adds template fields to an agreement
                AgreementFormFields result = apiInstance.AddTemplateFieldsToAgreement(authorization, ifMatch, agreementId, formFieldPostInfo, xApiUser, xOnBehalfOfUser);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AgreementsApi.AddTemplateFieldsToAgreement: " + e.Message );
            }

        }
    }
}

Notes

  1. All endpoints do not require authorization.

  2. Date formats can be changed in SwaggerDateConverter.cs.

  3. The enum names in CSharp SDK have missing underscores; for example, OUT_FOR_SIGNATURE will be OUTFORSIGNATURE.

namespace IO.Swagger.Client
{
    /// <summary>
    /// Formatter for 'date' swagger formats ss defined by full-date - RFC3339
    /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types
    /// </summary>
    public class SwaggerDateConverter : IsoDateTimeConverter
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SwaggerDateConverter" /> class.
        /// </summary>
        public SwaggerDateConverter()
        {
            // full-date   = date-fullyear "-" date-month "-" date-mday
            DateTimeFormat = "yyyy-MM-ddTHH:mm:ssZ";
        }
    }
}

Recommendation

Create an ApiClient instance per thread and per user (with baseUris fetched for each user) in a multithreaded environment to avoid any potential issues.

C# SDK Docs and downloads

Reporting issues

Please report issues on the Acrobat Sign Developer Forum.