0

I have created a template via the DocuSign UI; that template contains some tabs for various roles.

I want to send a document via DocuSign REST API, in which the template (only the tabs e.g. signHere, initiateHere, Title etc) will apply.

I haven't added any recipient on the template. What I want to use from that template are only the tabs.

My JSON

{
    "emailBlurb":"Test Email Body",
    "emailSubject": "Test Email Subject",
    "status" : "sent",
    "compositeTemplates": [
    {
        "serverTemplates": [
        {
            "sequence" : 1,
            "templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
        }],
        "inlineTemplates": [
        {
            "sequence" : 2,
            "recipients": {
                "signers" : [{
                    "email": "nalam@relisource.com",
                    "name": "Noor",
                    "recipientId": "1",
                    "roleName": "Applicant"
                }]
            }
        }],
        "document": {
            "documentId": 1,
            "name": "test1.pdf",
            "documentBase64":"Base64streamhere"
        }
    }]
}

It gives me the following error.

{
    "errorCode": "INVALID_CONTENT_TYPE",
    "message": "Content Type specified is not supported."
}

I am using POSTMAN. What is the problem here ?

Noor A Shuvo
  • 2,639
  • 3
  • 23
  • 48

2 Answers2

1

Your documentBase64 attribute doesn't look right. Perhaps an error in copying it? Also, setting the fileExtension is highly recommended:

It should be

"document": {
    ...
    "documentBase64": "Base64EncodedString",
    "fileExtension": "pdf"
}

I suggest you use API request logging to see exactly what Postman is sending.

Template document substitution

If you're trying to substitute a document at runtime for the document in a server template, see the answers to this SO question for additional tips.

Larry K
  • 47,808
  • 15
  • 87
  • 140
0

What you want here is the serverTemplate to be in sequence with the inlineTemplate so they need to have the same sequence number. Also you need another inline template to hold your document object. Something like this:

{
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject",
"status" : "sent",
"compositeTemplates": [
{
    "serverTemplates": [
    {
        "sequence" : 1,
        "templateId": "c9e5adfa-d708-4467-a0ea-c615fa429a0f"
    }],
    "inlineTemplates": [
    {
        "sequence" : 1,
        "recipients": {
            "signers" : [{
                "email": "nalam@relisource.com",
                "name": "Noor",
                "recipientId": "1",
                "roleName": "Applicant"
            }]
        }
    }],
    "inlineTemplates": [
    {
        "sequence" : 2
        "document": {
            "documentId": 1,
            "name": "test1.pdf",
            "documentBase64":"Base64streamhere"
        }
    }
}]

}