Search code examples
apisapui5postmandocusignapihttp-status-code-400

Docusign : 400 Error "Unable to parse multipart body" when trying to create envelope from Template ID from UI5 application


We are trying to figure out whether Docusign can be used in productive scenarios for our client requirements.

We have a UI5 application which will be used to sign Documents. We have created a template in the demo instance of Docusign.

However when we are trying to create an envelope from the application we are getting 400 Error Unable to parse multipart body. Now the same payload when used in POSTMAN application results in the envelope getting created successfully. The headers passed are also the same.

In Ui5 App :

var settings = {
                "async": true,
                "crossDomain": true,
                "url": "/docusign/envelopes",
                "method": "POST",
                "timeout": 0,
                "headers": {
                    "Authorization": "User DnVj27euWrCi4ANoMV5puvxVxYAcUCG3PlkUSpWpC08=, Organization 6ba64ce816dec995b17d04605e329a30, Element X4XuUq/T5UUh2o9xwaamZCCRwOKUCPr1Kv1Nj+qHPj0=",
                    "Content-Type": "application/json"
                },
                "data": JSON.stringify({
                    "status": "sent",
                    "compositeTemplates": [{
                        "compositeTemplateId": "1",
                        "inlineTemplates": [{
                            "recipients": {
                                "signers": [{
                                    "email": "[email protected]",
                                    "name": "John Doe",
                                    "recipientId": "1",
                                    "roleName": "Signer",
                                    "clientUserId": "12345",
                                    "tabs": {
                                        "textTabs": [{
                                            "tabLabel": "firstName",
                                            "value": "John"
                                        }, {
                                            "tabLabel": "lastName",
                                            "value": "Doe"
                                        }, {
                                            "tabLabel": "phoneNo",
                                            "value": "022-635363"
                                        }, {
                                            "tabLabel": "email",
                                            "value": "[email protected]"
                                        }]
                                    }
                                }]
                            },
                            "sequence": "1"
                        }],
                        "serverTemplates": [{
                            "sequence": "1",
                            "templateId": "0bf97611-a457-4e8e-ac7e-1593c17ba3f6"
                        }]
                    }]
                })
            };
    var deferred = $.Deferred();
            $.ajax(settings).done(function (response) {
                deferred.resolve(response);
            }.bind(this)).fail(function (error) {
                deferred.reject(error);
            }.bind(this));

In Postman : Successful POST

Headers

Help would be greatly appreciated in resolving this issue.


Solution

  • I was able to fix the issue by directly using the Docusign API (https://demo.docusign.net/restapi/v2/accounts). I was earlier using the SAP Openconnector to connect to Docusign. https://api.openconnectors.eu3.ext.hanatrial.ondemand.com/elements/api-v2

    Thanks all for the help.