简体   繁体   中英

DocuSign INVALID_CONTENT_TYPE on creating envelope

I am sending accesstoken along with document data but getting this error. Am I sending doc data in correct order

bodyData = {
  "status": "sent",
  "emailSubject": "Sent from the DocuSign REST API",
  "documents": [{
    "documentId": "1",
    "name": "contract.pdf",
    "documentBase64": "base64 document bytes...",
  }],
  "recipients": {
    "signers": [{
      "email": "....",
      "name": "Jane Dough",
      "recipientId": "....",
      "routingOrder": "1",
    }]
  }
}

curl.setHeaders([
  `Authorization: Bearer ${auth}`,
  "Content-Type: application/x-www-form-urlencoded"
])
  .setBody(bodyData)
  .post(`https://demo.docusign.net/restapi/v2/accounts/${accountId}/envelopes`)
  .then(({ statusCode, body, headers }) => {
    console.log('body : ', body)

    return res.status(200).json({
      success: true,
      data: body
    });
  })
  .catch(e => {
    console.log(e);
  });
    } catch (err) {
  console.log("err : ", err);
  // next(Boom.badImplementation(err));
}

Need to change the content_type to application/json

Also, need to ensure proper body is sent in the request.

I would also recommend you consider using the latest version, 2.1 of our eSig REST API

See documentation of this API here - https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM