0
votes

Creating an app in python that uses the Docusign API to delete user accounts. It appears I'll need the users userID to accomplish this so I need to make 2 calls, one to get the UserID and then one to delete the user. The problem is that when I make a response.get() for the user I get every user account.

email = sys.arg[1]
account_id = "<account_id goes here>"
auth = 'Bearer <long token goes here>'

head = {
'Accept': 'application/json',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=0.8,fa;q=0.6,sv;q=0.4',
'Cache-Control': 'no-cache',
'Origin': 'https://apiexplorer.docusign.com',
'Referer': 'https://apiexplorer.docusign.com/',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) \
    AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
'Authorization': auth,
'Content-Length': '100',
'Content-Type': 'application/json'}

url = 'https://demo.docusign.net/restapi/v2/accounts/{}/users'.format(account_id)
data = {"users": [{"email": email}]}
response = requests.get(url, headers=head, json=data)

print(response.text)

Why do I get a response.text with every user? And how can I just get a single user's information based on the e-mail address?

1

1 Answers

0
votes

With the v2 API you can do this using the email_substring query parameter that allows you to search on specific users.

GET /v2/accounts/{accountId}/users?email_substring=youremail

https://developers.docusign.com/esign-rest-api/v2/reference/Users/Users/list