docusign-esign-php-client icon indicating copy to clipboard operation
docusign-esign-php-client copied to clipboard

INVALID_REQUEST_BODY in EnvelopeRecipients: update

Open dalmarcolucas opened this issue 6 years ago • 11 comments
trafficstars

Im getting the envelopes recipients using the GET 'envelopes/{envelope_id}/recipients' endpoint.

After that i add the field 'clientUserId' and try to update the envelope, using the POST envelopes/{envelope_id}/recipients' endpoint with the very same array that i got from return from GET method as body.

But is returned the following error:

"The request body is missing or improperly formatted. Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'API_REST.Models.v2.recipientIdentityVerification' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath 'signers[0].identityVerification', line 1, position 120."

Obs: This was working last time i tested (december/2018)

dalmarcolucas avatar May 22 '19 14:05 dalmarcolucas

Duplicate of https://stackoverflow.com/questions/56261355/invalid-request-body-in-enveloperecipients-update

I have filed an internal ticket, DCM-3323

LarryKlugerDS avatar Jun 04 '19 10:06 LarryKlugerDS

Issue has been resolved

dbbrahmbhatt avatar Sep 02 '20 07:09 dbbrahmbhatt

hey, can you elaborate how to solve this? @dbbrahmbhatt I got the same error when trying to void the envelope:

    const env = new docusign.Envelope();
    env.status = 'voided';
    env.voidedReason = 'Voided by manager.';
    await envelopeApi.update(docusignConfig.accountId, envelopeId, env);

xinghul avatar Sep 15 '20 05:09 xinghul

I have re-opened the issue and have pinged the engineer for more information.

LarryKlugerDS avatar Sep 15 '20 06:09 LarryKlugerDS

Hi @xinghul , Apologies as I was not much clear in my earlier response. The issue here was, when we get the recipient info from the envelope, we were not able to use the same method body of "GET" action into the "POST" action because "POST" action was not accepting the "IdentityVerification" field in the same way we were getting it from the "GET" action. But as this issue was very old, I just reverified it whether it was still there or not and I found that the issue was no longer there, hence I closed it. I tried again today to verify with the same code you provided. But I am still not seeing this error. In my case, envelope got voided successfully without any error. Can you please provide more details on what JSON did you pass while creating the envelope in the first place? Also, if you can post the exact error you are getting, it would be helpful for us to troubleshoot. I want to know if you are getting the INVALID_REQUEST_BODY error because of the 'identityVerification' field or some other field.

dbbrahmbhatt avatar Sep 15 '20 16:09 dbbrahmbhatt

Hi @dbbrahmbhatt I am getting the same error as @xinghul

const dsApiClient = new docusign.ApiClient();
  dsApiClient.setBasePath(args.basePath);
  dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);

  const envelopesApi = new docusign.EnvelopesApi(dsApiClient)

  const env = new docusign.Envelope();
  env.status = 'voided';
  env.voidedReason = 'changed my mind';

  await envelopesApi.update(args.accountId, envelopeId, env);

The error I am getting is '{"errorCode":"INVALID_REQUEST_BODY","message":"The request body is missing or improperly formatted."}'

The creation of the envelope works, I can run through the signing process ok. I am returning a redirect url.

ValdarRudman avatar Nov 03 '20 09:11 ValdarRudman

@ValdarRudman , Please post the API Log for the PHP SDK call that you show in your issue.

We can then compare what was sent vs what the API wants.

LarryKlugerDS avatar Nov 03 '20 10:11 LarryKlugerDS

Sorry i posted this in the wrong place. I am using node.

ValdarRudman avatar Nov 03 '20 10:11 ValdarRudman

I was wracking my brain as to why I was getting this error. I was doing it through postman. It wasn't until I looked at the code snippet option that I noticed my issue. It was setting the url to curl --location --request POST 'https://demo.docusign.net/restapi/v2.1/accounts//envelopes/recipients' \ instead of curl --location --request POST 'https://demo.docusign.net/restapi/v2.1/accounts/a09*****-****-****-****-*************/envelopes/recipients' \. In my postman env the current value wasn't set but the intial value was. Reset the current value and it started to work.

RyanPnayR avatar Nov 11 '20 19:11 RyanPnayR

Also see https://stackoverflow.com/a/56432948/64904 I will be investigating further

LarryKlugerDS avatar Nov 12 '20 07:11 LarryKlugerDS

@LarryKlugerDS The situation with the "identityVerification" not happening anymore, but now we are having the same problem with the "signers[0].recipientSignatureProviders[0].signatureProviderOptions".

It is returned as an array by the "GET", and when sending the "PUT" request it demands to be an object:

"{"errorCode":"INVALID_REQUEST_BODY","message":"The request body is missing or improperly formatted. Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'API_REST.Models.v2_1.recipientSignatureProviderOptions' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath 'signers[0].recipientSignatureProviders[0].signatureProviderOptions', line 1, position 219."}"

dalmarcolucas avatar Oct 28 '22 22:10 dalmarcolucas