Zoho Assist API - python and requests library

Zoho Assist API - python and requests library

I am using the following python code which results in an error 400.  I setup the self-client and have received a clean token and can generate a new token via my refresh token.

  1. import requests
  2. import datetime
  3. import time
  4. import json

  5. api_url = 'https://assist.zoho.com/api/v2/reports'

  6. access_token = '1000.*****************************************************************'

  7. def dt():
  8.     one_week_ago = datetime.datetime.now() - datetime.timedelta(weeks=3)
  9.     fromdate = int(one_week_ago.timestamp())
  10.     fromdate = fromdate * 1000
  12.     todate = int(time.time())
  13.     todate = todate * 1000

  14.     return (fromdate, todate)

  15. #get unix from and to dtstamps and ensure they are longs per api spec
  16. getdate = dt()
  17. fromdate = int(getdate[0])
  18. todate = int(getdate[1])

  19. #set the report type per required argument
  20. type = 'rs'

  21. data = {
  22.     'type': type,
  23.     'fromdate': fromdate,
  24.     'todate': todate
  25. }
  27. headers = {
  28.     'Authorization': f'Zoho-oauthtoken {access_token}',
  29.     'Content-Type': 'application/json'
  30. }

  31. #send the api request
  32. response = requests.get(url=api_url, headers=headers, data=data)

  33. if response.status_code == 200:
  34.     print (f'Status Code: {response.status_code}')
  35.     try:
  36.         json_response = response.json()
  37.         print (json_response)
  38.     except json.decoder.JSONDecodeError as e:    
  39.         print("JSON Descoding error:", e)
  40. else:
  41.     print(f'API request failed with status code {response.status_code}')

      • Sticky Posts

      • TLS v1.2 Upgrade and Changes to System Requirements for Zoho Assist

        As we tighten our TLS v1.2 security update, admins and users need to be aware that supported versions of operating systems and web browsers will change after October 31st, 2018. After this date, we will retire support for clients using TLS v1.0 and TLS v1.1 protocols. In order to support these changes and meet the updated PCI standards please ensure that computers configured for Unattended Access are updated to TLS v1.2 and use web browsers that support the latest update. What is TLS v1.2, and why
      • Release Notes: Version 1.82, February 2015

        New Chrome Extension: Start a Session quickly! Recently, we have released a  Chrome Extension , which enables you to start a session instantly. You can simply enter your customer email address and start a session right from your browser extension. Make sure you are always logged-in to your Zoho account in your chrome browser so that you can avail the professional edition features if you are a paid customer. Supporting your Mac customers is much easier now! We have deployed a new Customer Console
      • Release Notes: Version 1.1205, May 2012

        This version of Zoho Assist includes the following changes. Enhanced Mac OS support We have increased the support quality and connection speed for the Mac OS. This will suit its higher resolution and enhanced graphics and to provide a better screen sharing experience. Smoother keyboard synchronization Typing and working with remote keyboard is a breeze now, with the refinements made in keyboard synchronization. This will achieve smooth and consistent remote support experience, just like working in
      • Please read this before making a post!

        Hello all Welcome to Zoho Assist forums. Zoho Assist is the remote support and remote access software from Zoho.  The sub-forums, 'General', 'Instant Remote Support' and 'Unattended Remote Access' that are listed in this forum are only for queries related to Zoho Assist. If you're looking for assistance or support on any other zoho products such as Zoho Mail, Zoho CRM etc., kindly check for the relevant product forum at https://help.zoho.com/portal/en/community/ Thanks in advance. Looking forward