docusignapi错误,调用UpdateNotificationSettings:{用户缺少对资源的权限

时间:2019-03-08 21:36:30

标签: docusignapi

使用模拟帐户和我的accountID,我试图在使用REST API创建的信封上更改“通知”设置。我得到下面的错误。这是我的帐户设置问题,还是我创建信封的方式问题?

  

调用UpdateNotificationSettings时出错:{    “ errorCode”:“ USER_LACKS_PERMISSIONS”,    “ message”:“此用户缺少足够的权限来访问此资源。”   }

代码:

Recipients recipients = new Recipients { Signers = new List<Signer>(signers) };
EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
{
    EmailSubject = "Review and sign the document",
    Documents = new List<Document>(documents),
    Recipients = recipients,
    Status = "sent"           
};
ApiClient apiClient = new ApiClient(basePath);
apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient.Configuration);
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);

Expirations exp = new Expirations("14", "true", "2");
EnvelopeNotificationRequest enr = new EnvelopeNotificationRequest(exp, null, null);

string envelopeId = results.EnvelopeId;

envelopesApi.UpdateNotificationSettings(accountId, envelopeId, enr);

1 个答案:

答案 0 :(得分:1)

您似乎在发送信封,然后尝试更改其有效期。

在调用CreateEnvelope()之前,将到期时间添加到信封定义中可能会得到更好的结果。尝试以下方法:

Recipients recipients = new Recipients { Signers = new List<Signer>(signers) };
EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition
{
    EmailSubject = "Review and sign the document",
    Documents = new List<Document>(documents),
    Recipients = recipients,
    Status = "sent"           
};

Expirations exp = new Expirations("14", "true", "2");
envelopeDefinition.Notification = new Notification(expirations)    

ApiClient apiClient = new ApiClient(basePath);
apiClient.Configuration.AddDefaultHeader("Authorization", "Bearer " + accessToken);
EnvelopesApi envelopesApi = new EnvelopesApi(apiClient.Configuration);
EnvelopeSummary results = envelopesApi.CreateEnvelope(accountId, envelopeDefinition);