import requests
import json
auth_token = "#####"
org_id = "####"
OAuth="Desk.tickets.CREATE"
ticket_data = {
"subject": "Testing",
"contactId": "2575624000007985016",
"departmentId": "741236985"
}
headers = {
"Authorization": auth_token,
"orgId": org_id,
}
request = requests.post('https://desk.zoho.com/api/v1/tickets', headers=headers, data=json.dumps(ticket_data))
if request.status_code == 200:
print("Request Successful,Response:")
print(request.content)
else:
print("Request not successful,Response code ", request.status_code, " \nResponse : ", request.content)
I have entered the all the feilds like authtoken,orgid,contactid correctly.
I have tried to create a Ticket but it was showing the below error.
Request not successful,Response code 422
Response : b'{"errorCode":"INVALID_DATA","message":"The data is invalid due to validation restrictions","errors":[{"fieldName":"/contactId","errorType":"invalid","errorMessage":""}]}'
I don't understand what the error is.
Could you please check this and get back to me ASAP.