For those who don’t want to read the whole question:
I’m looking for the index in the API-Request (Zammad) to set a tag while creating a ticket.
Details:
I’m using PHP to make an API-Request to my server where Zammad is installed. The following shows the data i sent via curl:
json_encode([ "title" => $title, "group_id" => 2, "priority_id" => 2, "category" => 'Some Category', "state_id" => 1, "type" => "Some Type", "customer" => $userID, "article" => [ "body" => $htmlBody, "type" => "note", "content_type" => "text/html", ], "tag_list" => [ // <-- The question is about this segment "The tag i want to add", ], ]);
After converting the data to JSON, im sending it via POST to http://<myServerIP>/api/v1/tickets
What I’ve tried so far:
I tried guessing the index of the tag at which i failed.
The first full example is shown above.
Secondly:
... "tag_id" => 9, // I've check its the actual ID of the tag i want to add
And Finally:
... "tag" => "The tag i want to add",
Needless to say that i didn’t succeed. Sometimes i get an error id (im assuming its because the index doesn’t exist [who would have thought that? :)]), sometimes i get nothing and Zammad just creates the ticket without the tag. What do i mean when i say sometimes? I refer my tries specified above.
What I’ve also tried:
Searching for some answer on the web. The thing that comes close to what i want is this. But i would rather create the ticket with the tag instead of making another request just to add the tag.
Advertisement
Answer
I’ve looked inside the code, its written in ruby. The index is ‘tags’ and needs to be sperated by ,
.
Basicly:
json_encode([ "title" => $title, "group_id" => 2, "priority_id" => 2, "category" => 'Some Category', "state_id" => 1, "type" => "Some Type", "customer" => $userID, "article" => [ "body" => $htmlBody, "type" => "note", "content_type" => "text/html", ], "tags" => "tag1,tag2,tag3", // or simply "tags" => "tag1" ]);
It might help someone in the future …