Created
October 10, 2020 15:04
-
-
Save crobrock/f44bf613e548d2ed1ebd84edae0f3947 to your computer and use it in GitHub Desktop.
Return Count of Zendesk Ticket View
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from base64 import b64encode | |
ZENDESK_SUBDOMAIN = 'YOUR_SUBDOMAIN' | |
ZENDESK_VIEW_ID = 'YOUR_ZENDESK_VIEW_ID' | |
ZENDESK_EMAIL = 'YOUR_ZENDESK_EMAIL' | |
ZENDESK_API_TOKEN = 'YOUR_ZENDESK_API_TOKEN' | |
url = f'https://{ZENDESK_SUBDOMAIN}.zendesk.com/api/v2/views/{ZENDESK_VIEW_ID}/count.json' | |
auth = f'{ZENDESK_EMAIL}/token:{ZENDESK_API_TOKEN}' | |
auth_encoded = b64encode(bytes(auth, 'utf-8')).decode('ascii') | |
headers = { | |
'Content-Type': 'application/json', | |
'Authorization': f'Basic {auth_encoded}' | |
} | |
data = requests.get(url, headers=headers).json() | |
view_count = data['view_count']['value'] | |
output = {'view_count': view_count} |
How can I meet my friends and family
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How this works