Hi There,
I am trying to use the MSXML2.XMLHTTP.6.0 active x object to implement an integration with docusign but seem to be having troubles.
Here is the example provided by docusign.
POST http://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: multipart/form-data; boundary=AAA
--AAA
Content-Type: application/json
Content-Dis"code" style="font:10pt/normal 'Courier New';color:#000000;text-transform:none;text-indent:0px;letter-spacing:normal;margin-margin-bottom:0px;word-spacing:0px;white-space:normal;widows:1;background-color:#e6e6fa;-webkit-text-stroke-width:0px;">{
"status":"sent",
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject - EnvelopeDefFull",
"documents": [{
"name": "test1.pdf",
"documentId":"1",
"order":"1"
}],
"recipients": {
"signers" : [{
"email": "m.rosey@thomasind.com ",
"name": "Mike Rosey",
"recipientId":"1",
}]
}
}
--AAA
Content-Type: application/pdf
Content-Dis filename="test1.pdf";documentid=1
<documents removed>
--AAA--
Here is my attempted translation which does not work:
oxmlhttprequest = createobject("MSXML2.XMLHTTP.6.0")
oxmlhttprequest.open("POST","https://demo.docusign.net/restapi/v2/accounts/738204/envelopes",.f.)
oxmlhttprequest.setrequestheader("Content-Type","application/json")
oxmlhttprequest.setrequestheader("Accept","application/json")
oxmlhttprequest.setrequestheader("X-DocuSign-Authentication","<DocuSignCredentials><Username>My username</Username><Password>My password</Password><IntegratorKey>My Key</IntegratorKey></DocuSignCredentials>")
cstr = '--AAA'
cstr = cstr + 'Content-Type: application/json'
cstr = cstr + 'Content-Dis"color:#1f497d;">cstr = cstr + '{'
cstr = cstr + ' "status":"sent",'
cstr = cstr + ' "emailBlurb":"Test Email Body",'
cstr = cstr + ' "emailSubject": "Test Email Subject - EnvelopeDefFull",'
cstr = cstr + ' "documents": [{'
cstr = cstr + ' "name": "test1.pdf",'
cstr = cstr + ' "documentId":"1",'
cstr = cstr + ' "order":"1"'
cstr = cstr + ' }],'
cstr = cstr + ' "recipients": {'
cstr = cstr + ' "signers" : [{'
cstr = cstr + ' "email": "smckay@power-broker.com",'
cstr = cstr + ' "name": "Stuart John McKay",'
cstr = cstr + ' "recipientId":"1",'
cstr = cstr + ' }]'
cstr = cstr + ' }'
cstr = cstr + '}'
cstr = cstr + '--AAA'
cstr = cstr + 'Content-Type: application/pdf'
cstr = cstr + 'Content-Dis filename="test1.pdf";documentid=1'
cstr = cstr + '<documents removed>'
cstr = cstr + '--AAA--'
oxmlhttprequest.send(cstr)
Any input would be greatly appreciated.
Stuart