ユーザーが Web サイトに来てドキュメントをアップロードする必要があり、別のユーザーがこのドキュメントに署名する必要があるというシナリオがあります。
私が今までやってきたこと:
Step1: 電子メール、パスワード、Integratorkey でログイン
function(next) {
var url = "https://demo.docusign.net/restapi/v2/login_information";
var body = ""; // no request body for login api call
// set request url, method, body, and headers
var options = initializeRequest(url, "GET", body, email, password);
// send the request...
request(options, function(err, res, body) {
if(!parseResponseBody(err, res, body)) {
return;
}
baseUrl = JSON.parse(body).loginAccounts[0].baseUrl;
next(null); // call next function
});
},
有効なアカウント ID を含む有効な応答を取得しています。
ステップ 2: この API を介してドキュメントをアップロードしています
function(next) {
var url = baseUrl + "/envelopes";
// following request body will place 1 signature tab 100 pixels to the right and
// 100 pixels down from the top left of the document that you send in the request
var body = {
"recipients": {
"signers": [{
"email": recipientEmail,
"name": recipientName,
"recipientId": 1,
"tabs": {
"signHereTabs": [{
"xPosition": "100",
"yPosition": "100",
"documentId": "1",
"pageNumber": "1"
}]
}
}]
},
"emailSubject": 'checkkkkkkkk API !!!!!',
"documents": [{
"name": "abc.pdf",
"documentId": 1,
}],
"status": "sent",
};
// set request url, method, body, and headers
var options = initializeRequest(url, "POST", body, email, password);
// change default Content-Type header from "application/json" to "multipart/form-data"
options.headers["Content-Type"] = "multipart/form-data";
// configure a multipart http request with JSON body and document bytes
options.multipart = [{
"Content-Type": "application/json",
"Content-Disposition": "form-data",
"body": JSON.stringify(body),
}, {
"Content-Type": "application/pdf",
'Content-Disposition': 'file; filename="' + documentName + '"; documentId=1',
"body": fs.readFileSync(documentName),
}
];
// send the request...
request(options, function(err, res, body) {
parseResponseBody(err, res, body);
envelopeId = JSON.parse(body).envelopeId;
console.log(envelopeId);
next(null);
});
},
ここで応答として、有効な EnvelopeID を取得しています (確かに!!)
ステップ 3: 別のユーザー (上記の受信者の電子メール/名前) に、 この API http://iodocs.docusign.com/APIWalkthrough/embeddedSigning#jsを使用して、自分の Web サイトの埋め込みビューでこのドキュメントに署名してもらいたいのです が、上記の使用された API によって返されなかった templateId とロールが必要です。これには、テンプレートをアップロードして templateID を取得するための手動の作業が必要です。これは、すべてを自動化したいため、私のシナリオでは不可能です。
埋め込み署名を続行する方法を誰かに教えてもらえますか。