API - create ticket - add cc'd emails

Hi, did a simple post to create a ticket.

But, I have a list of “customers” that I have an associated contact that I’d like cc’d.
I don’t think mentions will work well for me because not everyone has an ID.

Is there a way to create a ticket via API and add cc’d contacts?

Well, yes:
https://docs.zammad.org/en/latest/api/ticket/articles.html#create

Thanks. Looks like the docs are updated?

Anyway, yes, I was able to figure it out.

Yes and no.
The ticket endpoints have been re-arranged due to them growing slightly to reduce clusters.

However, documented payloads haven’t changed on that part.

1 Like

I’ve had success with the use of the createticket and guess: customer.

One more question, for the POST to create a ticket from email, is there any method for the POST to accept formatted text (i.e. with Returns, etc.)?

Well depends on your content type but in general for plain text your article payload would look like so:

{
   "ticket_id": 3,
   "to": "",
   "cc": "",
   "subject": "some subject",
   "body": "this\nis\nmagic",
   "content_type": "text/plain",
   "type": "note",
   "internal": false
}

and for HTML like so:

{
   "ticket_id": 3,
   "to": "",
   "cc": "",
   "subject": "some subject",
   "body": "this<br>is<br>magic",
   "content_type": "text/html",
   "type": "note",
   "internal": false
}

This can be used in the big ticket payloads or with the article endpoint: /api/v1/ticket_articles

Thank you for that. I’ll try a rev with that.

Is there/what is the character limit on the body for the POST?

Theoretically from database end you can expect something around 20MB - so something way above 15.000 chars without issues as far as I’m aware.

Always depends on your webserver (max post sizes) and the client you use through.

1 Like

Thanks for that info about the limits. I wasn’t sure. And the comment about the HTML is helpful for the little dashboard we are starting to use internally.

Our API is working well from our integrated with info from another contact management system.

But another question, is it possible to set the ticket “owner” during ticket creation as well?
I do not see it as an option.

"owner":"jdoe"

Use this to have a look at one of your tickets:
https://docs.zammad.org/en/latest/api/intro.html

The response will give you a lot of clues about which attributes you can set via API.

cheers

Yes, I have looked at that documentation.
I don’t see anything related to the owner for the ticket endpoint.
https://docs.zammad.org/en/latest/api/ticket.html

But thanks for confirming.

That’s not what i meant.

Use the API to just look at one of your tickets. The response of that should give you some information about how the fields are called/filled.

Alternatively you could use rails for this:
https://docs.zammad.org/en/latest/admin/console.html

cheers

1 Like