docusign / docusign-esign-node-client

The Official DocuSign Node.js Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
http://docusign.github.io/docusign-esign-node-client
MIT License
146 stars 100 forks source link

Getting a list of tags from a template #65

Closed alexpchin closed 7 years ago

alexpchin commented 7 years ago

Hello,

I'm trying to create an envelope and then query the list of tags present in that envelope in order to populate them dynamically. After calling envDef.setTemplateId('xxx') is there a way to query the tags similar to https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{templateId}}/recipients?include_tabs=true&include_extended=true so that these can then be populated dynamically?

I can't seem to find this in the API docs.

Or even: GET /v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients

I can achieve by writing:

rp({
        method: 'get',
        uri: `${config.docusign.baseUrl}/v2/accounts/${accountId}/templates/${templateId}/recipients?include_tabs=true&include_extended=true`,
        headers: {
          'X-DocuSign-Authentication': creds
        },
        json: true
      })
      .then(response => {
        console.log(response.signers.tabs.textTabs)

.
.
.

But is there something within the library that does this call?

mmallis87 commented 7 years ago

For the first call you can use listRecipients method (make sure to use the envelopeId that you get when you make the call to createEnvelope, rather than templateId): https://github.com/docusign/docusign-node-client/blob/e7dadaf65cb26598f993cc9cc950177ce1ec19a5/src/api/EnvelopesApi.js#L3232

The second call is getRecipients, as shown here: https://github.com/docusign/docusign-node-client/blob/e7dadaf65cb26598f993cc9cc950177ce1ec19a5/src/api/BulkEnvelopesApi.js#L198

You can also consult the SDK docs for information about these calls: https://docusign.github.io/docusign-node-client/

alexpchin commented 7 years ago

Hello @mmallis87 the second one is a different url?

${config.docusign.baseUrl}/v2/accounts/${accountId}/templates/${templateId}/recipients?include_tabs=true&include_extended=true

mmallis87 commented 7 years ago

Oh sorry, I thought that you were interested in BulkEnvelopes.

In that case what you're looking for is listRecipients from TemplatesApi: https://github.com/docusign/docusign-node-client/blob/e7dadaf65cb26598f993cc9cc950177ce1ec19a5/src/api/TemplatesApi.js#L1654

It's pretty similar to the first link that is part of EnvelopesApi. This page list all DocuSign eSignature APIs: https://docs.docusign.com/esign/restapi/

alexpchin commented 7 years ago

I'm probably being a numpty... but:

return new Promise((resolve, reject) => {
  const templatesApi = new docusign.TemplatesApi();
  templatesApi.listRecipients(accountId, templateId, {
    includeTabs: true
  }, function(error, data, response) {
    if (error) return reject(error);
    return resolve(data);
  });
});

Throws me an error: callback is not a function

mmallis87 commented 7 years ago

Make sure to use the latest version 3.0.0.

alexpchin commented 7 years ago

@mmallis87 Thanks that was it! Shall I close?

mmallis87 commented 7 years ago

You're welcome! I can close it for you.

Happy DocuSigning!