The simplest way to get your overall usage for the month is to check the account/get endpoint response because it has the number of requests left in the month. Also, at any point, you can see exactly how many signature requests have been created under your account.
However, you may want a more detailed look at the signature requests you are sending out, with the ability to query by certain criteria. If you use the GET /signature_request/list endpoint with no query parameters, you will get a list of ALL signature_request_ids associated with your API Key. You can use query parameters to narrow this list by a number of options, including whether a request is complete, what date it was created, or who it was from. Here are all of the parameters that you could include in your search: https://app.hellosign.com/api/reference#Search
If you want to view more complete data about each signature_request_id, you can use the signature_request/get endpoint, which takes a signature_request_id and returns back detailed information about it. If you need this information for every signature request in your list, you can pull all of the signature_request_ids from your list query and put them into an array, and then loop through the array calling signature_request/get. The results from /list are paginated, so if you have many results, you will need to cycle through all of your pages. Here is an example of creating that array in Ruby, using our Ruby SDK. The first block is calling the /list endpoint and pulling the request ids to create an array on a single page of results:
def getRequestIdsFromListPage(page_number)
response = HelloSign.get_signature_requests :page => page_number, :page_size => 100
ids = Array.new([])
data = response.data
signature_requests = data["signature_requests"]
signature_requests.each { |signature|
ids.push(signature["signature_request_id"])
}
return ids
end
def getRequestDetailsLoop(page_number)
id_array = getRequestIdsFromListPage(page_number)
p id_array
id_array.each { |id|
HelloSign.get_signature_request :signature_request_id => id
}
end
Search by date
If you'd like to see how many signature requests have been created in any timeframe, here's how you'd structure the request in cURL, assuming you wanted to see the results of all non-test_mode signature requests created between 2017-10-01 (October 1st, 2017), and 2017-10-31 (October 31st, 2017):
curl -X GET \
'https://api.hellosign.com/v3/signature_request/list?page_size=100&query=created:%7B2017-10-01+TO+2017-10-31%7D+AND+test_mode:false' \
-H 'Authorization: Basic [basic_auth_key_here]=' \
-H 'Cache-Control: no-cache'
Note the URL encoded braces {} around the dates.
Comments
0 comments
Article is closed for comments.