I'm using the Docusign REST API to create envelopes, then I call the POST Recipient View method to generate the recipient view.
The documentation indicates:
You can use with userId or email and userName to identify the recipient. If userId is used and a clientUserId is provided, the userId must match a recipientId (which can be retrieved with a GET recipients call) for the envelope.
I know for sure userName can change if the user types a different full name when adopting the signature, so I'm favoring userId. As suggested in that documentation I call GET recipients right after creating the envelope, and I store all the userId guids.
Later, when the recipient is ready to sign and I call POST Recipient View I send the userId I saved earlier and the clientUserId (because it's an embedded recipient). Most of the times it works, but sometimes I get an error:
{
"errorCode": "INVALID_REQUEST_PARAMETER",
"message": "The request contained at least one invalid parameter. A value was not found for parameter 'userName'."
}
When that happened the first time I called GET Recipients for that failed envelope and I noticed the userId I captured when the envelope was created doesn't match the current userId.
My workaround is to call GET Recpients, get the current userId, and call POST Recipient View again. That's not ideal.
Questions/comments:
- Is userId changing during the lifetime of an envelope?
- What's the best practice to obtain the proper userId? Get it after creating the envelope? Get it right before creating the recipient view?
- It would be great if the API returned the userIds in the response coming back when creating the envelope.