Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

send_with_template endpoint should add file[] or file_url[] as supported params #43

Closed
alexmac05 opened this issue Apr 11, 2018 · 3 comments · Fixed by #51
Closed

send_with_template endpoint should add file[] or file_url[] as supported params #43

alexmac05 opened this issue Apr 11, 2018 · 3 comments · Fixed by #51

Comments

@alexmac05
Copy link
Contributor

alexmac05 commented Apr 11, 2018

re:
@api.hellosign.com/v3/signature_request/send_with_template endpoint
https://app.hellosign.com/api/reference#send_with_template
Needs to be expanded to include the ability to also send a this parameter:

file[] or file_url[] optional Append additional files to the signature request. HelloSign will parse the files for text tags. Text tags for signers not on the template will be ignored.

Use file[] to pass the uploaded file(s). Use file_url[] to have HelloSign download the file(s). We currently only support use of either the file[] parameter or file_url[] parameter, not both.

NOTE: internal issue AS-97

@alexmac05
Copy link
Contributor Author

alexmac05 commented Apr 13, 2018

Workaround:

import requests

buildTheRequest = 'https://' + apikey + ':@api.hellosign.com/v3/signature_request/send_with_template'
ndafile = {'file[0]': open('NDA.pdf', 'rb')}
data = {
'template_id': 'XXXXXXXXXX',
'subject': 'workaround',
'allow_decline': '1',
'message': 'workaround',
'signers[Client][name]': 'George',
'signers[Client][email_address]': 'example@example.com',
'custom_fields': '[{"name":"newline", "value":"$20,000", "editor":"Client", "required":true}]',
'test_mode': '1'
#'file_url': 'https://i.ytimg.com/vi/JPA_rzHDy6o/maxresdefault.jpg'
}
print(buildTheRequest)
r = requests.post(buildTheRequest, data, files=ndafile)
print(r.text)
stringData = r.text
result = json.loads(stringData)
print(result)

@alexmac05
Copy link
Contributor Author

To add multiple files:
ndafile = {'file[0]': open('NDA.pdf', 'rb'), 'file[1]': open('NDA2.pdf', 'rb') }

@alexmac05
Copy link
Contributor Author

buildTheRequest = 'https://' + apikey + ':@api.hellosign.com/v3/signature_request/send_with_template'

ndafile = {'file[0]': open('NDA.pdf', 'rb'), 'file[1]': open('NDA2.pdf', 'rb') }

    data = {
        'template_id': 'dd1532dc8e14925eeb536bd933edd9e957ae5336',
        'subject': 'ticket214090',
        'allow_decline': '1',
        'message': 'ticket214090',
        'signers[Client][name]': 'George',
        'signers[Client][email_address]': 'example@example.com',
        'custom_fields': '[{"name":"newline", "value":"$20,000", "editor":"Client", "required":true}]',
        'test_mode': '1'
    }
    print(buildTheRequest)

    r = requests.post(buildTheRequest, data, files=ndafile)
    print(r.text)
    stringData = r.text


    result = json.loads(stringData)
    print(result)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant