Hello py community.
I am new to python and have done some programming to extract data from Time Doctor API using python. I am successful is in some categories but when I try to access Users data it say that I don’t have permissions to perform this action. I am sharing my code so that you guys can help in finding appropriate correction.
When use the above credentials in time doctor documentation in following link
https://timedoctor.redoc.ly/#operation/getUsers
It works perfectly.
However, in following code: it gives error
#----------Get Users Start of Code
users_url = "https://api2.timedoctor.com/api/1.0/users?company=" + company_id + "&user=#&manager=#&tag=#&self=#&detail=#&task-project-names=#&no-tag=#&deleted=#&page=#&limit=#&sort=#&filter%5Bid%5D=#&filter%5Bemail%5D=#&filter%5Bname%5D=#&filter%5Btag%5D=#&filter%5Bkeywords%5D=#&filter%5Brole%5D=#&filter%5BshowOnReports%5D=#&filter%5BpayrollAccess%5D=#&filter%5Bscreenshots%5D=#&filter%5Bvideos%5D=#&filter%5Bcreated%5D=#&filter%5BhostName%5D=#&filter%5Bos%5D=#&filter%5BhiredAt%5D=#&filter%5BlastTrack%5D=#&filter%5BlastActiveTrack%5D=#&filter%5BclientVersion%5D=#&filter%5Bip%5D=#&filter%5Bshow-on-reports%5D=#&filter%5Bpayroll-access%5D=#&filter%5Bhost-name%5D=#&filter%5Bhired-at%5D=#&filter%5Blast-track%5D=#&filter%5Blast-active-track%5D=#&filter%5Bclient-version%5D=#&token=" + login_token
users_query = {
"company": company_id,
"user": "",
"manager": "",
"tag": "",
"self": "",
"detail": "",
"task-project-names": "",
"no-tag": "",
"deleted": "",
"page": "",
"limit": "",
"sort": "",
"filter[id]": "",
"filter[email]": "",
"filter[name]": "",
"filter[tag]": "",
"filter[keywords]": "",
"filter[role]": "",
"filter[showOnReports]": "",
"filter[payrollAccess]": "",
"filter[screenshots]": "",
"filter[videos]": "",
"filter[created]": "",
"filter[hostName]": "",
"filter[os]": "",
"filter[hiredAt]": "",
"filter[lastTrack]": "",
"filter[lastActiveTrack]": "",
"filter[clientVersion]": "",
"filter[ip]": "",
"filter[show-on-reports]": "",
"filter[payroll-access]": "",
"filter[host-name]": "",
"filter[hired-at]": "",
"filter[last-track]": "",
"filter[last-active-track]": "",
"filter[client-version]": "",
"token": login_token
}
users_response = requests.get(users_url, params=users_query)
users_data = users_response.json()
print('''
Users DATA''')
print(users_data)
#----------Get Users End of Code
Here is my output
Users DATA
{'error': 'denied', 'thrown': '2022-06-09T09:27:31.280Z', 'message': "Your don't have permission to perform this action."}
I would be greatful if anyone can help in correcting my mistake.
Looking forward to your support.
Thanks.
Sulaiman