简体   繁体   English

如何在 React.js 中使用 DocuSign API?

[英]How to use DocuSign API with React.js?

I need to do a POC of some DocuSign e-Signature features in a React.js environment.我需要在 React.js 环境中做一些 DocuSign 电子签名功能的 POC。 For starters, I would like to play with the examples as mentioned here https://github.com/docusign/code-examples-node/tree/master/lib/eSignature .对于初学者,我想使用这里提到的示例https://github.com/docusign/code-examples-node/tree/master/lib/eSignature The official documentation is not self explanatory on how to use these in a React.js code repo(exported from create-react-app).官方文档没有解释如何在 React.js 代码库中使用这些(从 create-react-app 导出)。 Neither could I find some relevant samples for a reference.我也找不到一些相关的样本作为参考。 Would appreciate if anyone can guide me on how can I port the examples in this repo https://github.com/docusign/code-examples-node in a React.js environment.如果有人能指导我如何在 React.js 环境中移植这个 repo https://github.com/docusign/code-examples-node中的示例,我将不胜感激。

For React.JS:对于 React.JS:

  1. You can make a direct API call from your React app.您可以从 React 应用程序直接调用 API。 In this case you will not use the node.js SDK (it only works with Node.js).在这种情况下,您将不会使用 node.js SDK(它仅适用于 Node.js)。 The API call is the create envelope call documented here: https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create/ API 调用是此处记录的创建信封调用: https : //developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create/

You can see an example of the API call here: https://github.com/docusign/code-examples-bash/blob/master/examples/eSignature/eg017SetTemplateTabValues.sh#L68您可以在此处查看 API 调用示例: https : //github.com/docusign/code-examples-bash/blob/master/examples/eSignature/eg017SetTemplateTabValues.sh#L68

You will also need to implement a private CORS gateway.您还需要实施私有 CORS 网关。 We have an article on doing so plus code examples: https://www.docusign.com/blog/dsdev-building-single-page-applications-with-docusign-and-cors-part-2 2. Alternative is for your React app to ask your server app to call DocuSign.我们有一篇关于这样做的文章以及代码示例: https : //www.docusign.com/blog/dsdev-building-single-page-applications-with-docusign-and-cors-part-2 2. 替代方案适合您React 应用程序要求您的服务器应用程序调用 DocuSign。 Your server app could use the Node.js SDK.您的服务器应用程序可以使用 Node.js SDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM