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

Add get_url param to GET /signature_request/files/:signature_request_id #17

Closed

Description

@alexmac05

Add get_url param to GET /signature_request/files/:signature_request_id

Endpoint:
GET /signature_request/files/[:signature_request_id]
The API documentation for this endpoint includes a parameter called:
get_url

It is marked optional. It is a boolean. It goes on to say....."If true, the response will contain a url link to the file instead. Links are only available for PDFs and have a TTL of 3 days. (default = false)"

However,

python SDK
https://github.com/HelloFax/hellosign-python-sdk/blob/v3/hellosign_sdk/hsclient.py
line: 317 does not have a get_url parameter

If you try to use it then you get the following error message:
TypeError: get_signature_request_file() got an unexpected keyword argument 'get_url'

Activity

  1. alexmac05 commented on Dec 9, 2017

    @alexmac05
    ContributorAuthor

    Workaround:

    current_signatureRequestID = 'XXXXXXXXXXXXXXXXXX'

    buildTheRequest = 'https://' + apikey + ':@api.hellosign.com/v3/signature_request/files/'
    + current_signatureRequestID + "?get_url=True"

    r = requests.get(buildTheRequest)
    urlOfDocument = r.text
    urlOfDocument = urlOfDocument.replace("\","")
    print(urlOfDocument)

    #Create a substring from : to the end. But chop off : AND } and convert to a number and then do the convert call
    getUTC = urlOfDocument.split(':')[3]
    getUTC = getUTC[:-1]

    getURL = urlOfDocument.split('"')[3]
    print(getURL)

    #Figure out the UTC expires at value
    print(convertUTCtoLocal(getUTC))

    def convertUTCtoLocal(utcValue):
    if utcValue != None:
    print('nonempty time value given')
    return time.strftime("%Z - %Y/%m/%d, %H:%M:%S", time.localtime(float(utcValue)))
    else:
    return "Empty time value given"

  2. jameschristopher commented on Feb 9, 2018

    @jameschristopher

    This works for me

    import requests
    
    def get_signature_request_file(signature_request_id, *args, **kwargs):
        path = 'https://api.hellosign.com/v3/signature_request/files/' + signature_request_id
        r = requests.get(path, params=kwargs, auth=(HELLOSIGN_API_KEY, ''))
        return r.json().get('file_url')
    
    file_url = get_signature_request_file(signature_request_id, get_url=True)
  3. oconnor-sn commented on Dec 16, 2019

    @oconnor-sn
    Contributor

    Can this be closed, due to merge of PR 51

  4. alexmac05 commented on Dec 24, 2019

    @alexmac05
    ContributorAuthor

    @oconnor-sn and @neillom Testing this is not showing it working.

    Example:

    urlResponse = client.get_signature_request_file(
        signature_request_id='PUT_NUMBER_HERE',
        file_type="url",
        filename="test.pdf"
    )
    

    This does not work with or without filename="test.pdf" in the pass. I do think that filename is acting like it is required and that might be another issue with this fix. However, no combination that I can find is working to show that this fix is working for me.

    To see it working in curl you can run this:

    curl 'https://api.hellosign.com/v3/signature_request/files/Signature_Request_ID?get_url=1'
    -u 'API_KEY:'

    that will return a ULR where you will need to change some of the slashes around to get it to display the file:

    results

    {"file_url":"https://s3.amazonaws.com/hellofax_uploads/super_groups/2019/12/23/45e55ebbf2de5e181e272577b7ea67d674f86592/merged-tamperproofed.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUMSXJYX53PFVNTGX%2F20191224%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191224T002810Z&X-Amz-SignedHeaders=host&X-Amz-Expires=259200&X-Amz-Signature=XXXXXXXXXXXXXXXXXXXXXXXX","expires_at":1577406490}

    Change that to:
    {"file_url":"https://s3.amazonaws.com/hellofax_uploads/super_groups/2019/12/23/45e55ebbf2de5e181e272577b7ea67d674f86592/merged-tamperproofed.pdf?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUMSXJYX53PFVNTGX%2F20191224%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20191224T002810Z&X-Amz-SignedHeaders=host&X-Amz-Expires=259200&X-Amz-Signature=XXXXXXXXXXXXXXXXXXXXXXXX","expires_at":1577406490}

  5. alexmac05 commented on Dec 24, 2019

    @alexmac05
    ContributorAuthor

    This works in Python SDK version 3.8.9 and here is the syntax:

    urlResponse = client.get_signature_request_file(
    signature_request_id='Signature_REQUEST_ID_HERE',
    response_type="url",
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions