When creating tickets or their articles via API-Token and on-behalf of someone, you’ll need admin.user
permission. This should be enough - however, the affected user needs ticket.agent
(if agent) with fitting permissions.
The token permission looks like so:
I can create tickets on behalf without any issues.
Please however note that you need to provide an article with ticket creation.
I don’t know if the php api libary does something super special or different here.
You can cross check by using curl with on behalf:
curl --location --request POST 'https://X.zammad.com/api/v1/tickets' \
--header 'X-On-Behalf-Of: 8' \
--header 'Authorization: Bearer XYZ' \
--header 'Content-Type: application/json' \
--data-raw '{
"group_id": 1,
"priority_id": 2,
"state_id": 1,
"organization_id": 1,
"title": "API-Test!",
"owner_id": 1,
"customer_id": 8,
"note": null,
"first_response_at": null,
"first_response_escalation_at": null,
"first_response_in_min": null,
"first_response_diff_in_min": null,
"close_at": null,
"close_escalation_at": null,
"close_in_min": null,
"close_diff_in_min": null,
"update_escalation_at": null,
"update_in_min": null,
"update_diff_in_min": null,
"last_contact_at": "2020-05-20T06:32:23.991Z",
"last_contact_agent_at": null,
"last_contact_customer_at": "2020-05-20T06:32:23.991Z",
"last_owner_update_at": null,
"escalation_at": null,
"pending_time": null,
"time_unit": null,
"updated_by_id": 8,
"created_by_id": 8,
"created_at": "2020-05-20T06:32:23.808Z",
"updated_at": "2020-05-20T06:32:24.019Z",
"article": {
"to": "Good Guy <agent@example.net>",
"cc": "",
"from": "Evil Guy <evil@example.com>",
"subject": "some subject",
"body": "huhuhuu<br>huhuhuu<br>huhuhuu<br><br>",
"content_type": "text/html",
"type": "email",
"sender": "Customer",
"internal": false,
"preferences": {},
"created_at": "2020-05-20T06:32:23.808Z"
}
}'
If the curl command works, it’s not a direct Zammad bug, but tied to the api libary for php.
In this case the production log should hold a hint what went wrong. This is also the error you’ll need in order to be able to create a bug report on the fitting repo.
I hope this helps