当我尝试从模板创建信封时,我得到以下响应:
{ errorCode: 'UNSPECIFIED_ERROR',
message: 'Non-static method requires a target.' }
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的事情:
首先我登录,返回
{ loginAccounts:
[ { name: '*****',
accountId: '*****',
baseUrl: 'https://demo.docusign.net/restapi/v2/accounts/******',
isDefault: 'true',
userName: '***** ********',
userId: '*******-*****-*****-*****-*********',
email: '********@*******.com',
siteDescription: '' } ] }
Run Code Online (Sandbox Code Playgroud)
那么我从该响应中取出baseUrl并尝试创建信封.我正在使用hapi框架和async.waterfall异步库,所以对于不熟悉其中任何一个的人,我使用异步库使用next回调调用下一个函数,在这种情况下将获取iframe的url,并且我们使用hapi框架AppServer.Wreck粗略等同于request:
function prepareEnvelope(baseUrl, next) {
var createEntitlementTemplateId = "99C44F50-2C97-4074-896B-2454969CAEF7";
var getEnvelopeUrl = baseUrl + "/envelopes";
var options = {
headers: {
"X-DocuSign-Authentication": JSON.stringify(authHeader),
"Content-Type": "application/json",
"Accept": "application/json",
"Content-Disposition": "form-data"
},
body : JSON.stringify({
status: "sent", …Run Code Online (Sandbox Code Playgroud)