I did exactly like bernd and try to create a ticket with an unknown user using the guess: way
Unfortunately it doesnt work.
Are there any changes with zammad 4.x that caused it to stop working?
If so, wouldnt make it support it again. Especially when providing Supports-Widget on web I love to not check/create for existing users but let the system do it right away.
I tried with both X-Behalf-of header and without. The ticket is created is created when using x-behalf-of, but then with the existing account instead of the new one that should be created.
Oh yes, please.
We have an own “Create new ticket” form in our application and are jumping through the following hoops to create a ticket:
Check if user exists
GET /api/v1/users/search?limit=1&query=email.keyword:potentiallyNewCustomer@example.com X-On-Behalf-Of null
if not exist, create it
POST /api/v1/users X-On-Behalf-Of null
create ticket with the user.id of the new or existing user from above:
POST /api/v1/tickets/ with X-On-Behalf-Of: user.id from above
Would be great to just do it in one shot.
The newly created ticket should belong to the customer (by email).
Initially I would have had expected that X-On-Behalf-Of would work like this, but it fails if the user does not exist yet.
Ok thanks. This saves the first call.
I need to find out how the error looks like. Unfortunately errors are often an HTML page instead of a JSON response. Maybe we decided for the approach with 3 calls, so we have proper JSON everytime, as HTML-error pages also could mean “Service unavailable”, and parsing error message in HTML is not fun