Hi, I am using a Zendesk trial account and getting a 403 response for the API below. All other APIs are working fine with the same credentials. I have ensured that I am doing a POST request and using the correct API URL with https.
What might be the problem?
API that is not working - POST /api/v2/custom_objects/{custom_object_key}/jobs
APIs that are working with the same credentials:
Create Custom Object Record POST /api/v2/custom_objects/{custom_object_key}/records
List Custom Objects GET /api/v2/custom_objects
I referred to this article: https://developer.zendesk.com/api-reference/custom-data/custom-objects/custom_object_records/#custom-object-record-bulk-jobs
I am using the code below to execute the API (sensitive fields masked):
url = "https://<account_id>.zendesk.com/api/v2/custom_objects/cars/jobs"
payload = json.loads("""{
"job":
{
"action": "create",
"items":
[
{
"custom_object_fields":{
"color": "Red",
"year": 2020
},
"name": "2020 Tesla"
}
]
}
}""")
headers = {
"Content-Type": "application/json",
}
email_address = '<email>'
api_token = '<token>'
# Use basic authentication
auth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request("POST", url, auth=auth, headers=headers, json=payload)
print(response.text)
Thanks for raising this questions. I believe this is the same request that is on ticket - 13448336, right? If that is the case, I will merge this one to avoid duplications.
We'll make sure to assist you on the other ticket.