I want to import Tickets in sense of a migration. Using https://<domain>.zendesk.com/api/v2/imports/tickets in the browser shows following error message:
{"error":"InvalidEndpoint","description":"Not found"}
Using python code similar to the example given in the API documentation also leads to the error. Other endpoints work in this way.
import json
import requests
import_url = 'https://<domain>.zendesk.com/api/v2/imports/tickets?archive_immediately='
print(import_url)
headers = {
'Authorization': 'Basic xxx=',
'content-type': 'application/json'
}
data={"ticket":{"subject":"Ticket for Import Test","description":"This is a test ticket","requester_id":1900466156814,"submitter_id":378414422420,"assignee_id":378414422420,"organization_id":382262135560,"group_id":1900000676394}}
payload = json.dumps(data)
response = requests.put(import_url, headers=headers, data=payload)
if response.status_code == 200:
print('Done!')
else:
print('Error code: ' + str(response.status_code))
print('Error text: ' + str(response.text))
Output
Error code: 404
Error text: {"error":"InvalidEndpoint","description":"Not found"}
For Team member authentication we use Single sign-on, not Zendesk authentication. The user used in our scripts has administrator permissions as required by the API.