Hi. I'm trying to export our KB articles using this ZD documentation: https://developer.zendesk.com/documentation/help_center/help-center-api/backing-up-your-knowledge-base-with-the-help-center-api/
Because we use SSO and 2FA to log into ZD, I changed the authentication method in the script from credentials to API key. I believe I formatted the script correctly, but I'm getting an unexplained 404. Any thoughts about what might be going wrong?
Here's my modified version of the Python script provided in the documentation:
import os
import datetime
import requests
api_token = 'MY_ZENDESK_TOKEN'
zendesk = 'https://securityscorecard.zendesk.com'
language = 'en_US'
date = datetime.date.today()
backup_path = os.path.join(str(date), language)
if not os.path.exists(backup_path):
os.makedirs(backup_path)
headers = {
'Authorization': f'Bearer {api_token}',
}
endpoint = zendesk + '/api/v2/help_center/en-US/articles.json'.format(locale=language.lower())
response = requests.get(endpoint, headers=headers)
if response.status_code != 200:
print('Failed to retrieve articles with error {}'.format(response.status_code))
exit()
data = response.json()
for article in data['articles']:
print(article['id'])