# Zammad

# Introducción

Plugin para gestionar *tickets* en Zammad, puedes crear, eliminar y actualizar *tickets*.

# Matriz de compatibilidad

<table border="1" id="bkmrk-sistemas-donde-se-ha" style="border-collapse: collapse; width: 100%; height: 84px;"><tbody><tr style="height: 28px;"><td style="width: 30.4073%; height: 28px;">**Sistemas donde se ha probado**</td><td style="width: 69.5927%; height: 28px;">CentOS 7, Fedora.

</td></tr><tr style="height: 28px;"><td style="width: 30.4073%; height: 28px;">**Sistemas donde debería funcionar**</td><td style="width: 69.5927%; height: 28px;">Cualquier sistema GNU/Linux.

</td></tr></tbody></table>

# Pre requisitos

Se requiere:

- Habilitar autenticación básica o mediante *token* de la API.
- \* Python3 .
- \* Librería [requests](https://pypi.org/project/requests/).

**\* En la versión binaria del *plugin* no es requerido tener estas dependencias puesto que ya vienen incluidas en el compilado.**

# Configuración

Se tiene que habilitar la autenticación mediante *token* ( **Access Token** ) o básica ( **Acceso a Password** ) haciendo clic en **Administrar** y luego en **API**.

[![pfms-bookstack-zimmad-image-01.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/pfms-bookstack-zimmad-image-01.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/pfms-bookstack-zimmad-image-01.png)

El *token* se crea haciendo clic en **Perfil** y luego en **Access token**:

[![pfms-bookstack-zimmad-image-02.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/scaled-1680-/pfms-bookstack-zimmad-image-02.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-04/pfms-bookstack-zimmad-image-02.png)

Para que funcione debe poner `ticket.agent` en permisos.

# Parámetros

**Parámetros**

<table border="1" id="bkmrk-method--m-get%2Cpost%2Cp" style="height: 435px; width: 45.3086%;"><tbody><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">Method</td><td style="height: 29px; width: 15.8408%;">-m</td><td style="height: 29px; width: 52.9967%;">get,post,put o delete</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">host</td><td style="height: 29px; width: 15.8408%;">-i, --ip</td><td style="height: 29px; width: 52.9967%;">nombre de tu sitio zammad</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">user</td><td style="height: 29px; width: 15.8408%;">-us</td><td style="height: 29px; width: 52.9967%;">nombre de tu usuario (email)</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">password</td><td style="height: 29px; width: 15.8408%;">-p</td><td style="height: 29px; width: 52.9967%;">pass de la API</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">token</td><td style="height: 29px; width: 15.8408%;">-t </td><td style="height: 29px; width: 52.9967%;">token de la API</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket name</td><td style="height: 29px; width: 15.8408%;">-tn</td><td style="height: 29px; width: 52.9967%;">nombre del ticket</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket comment</td><td style="height: 29px; width: 15.8408%;">-tb</td><td style="height: 29px; width: 52.9967%;">contenido (texto) del ticket</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket id</td><td style="height: 29px; width: 15.8408%;">-id</td><td style="height: 29px; width: 52.9967%;">id del ticket</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket status</td><td style="height: 29px; width: 15.8408%;">-ts</td><td style="height: 29px; width: 52.9967%;">estado</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket priority</td><td style="height: 29px; width: 15.8408%;">-tp</td><td style="height: 29px; width: 52.9967%;">prioridad</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket type</td><td style="height: 29px; width: 15.8408%;">-tt</td><td style="height: 29px; width: 52.9967%;">tipo</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket group</td><td style="height: 29px; width: 15.8408%;">-tg</td><td style="height: 29px; width: 52.9967%;">grupo</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket subject</td><td style="height: 29px; width: 15.8408%;">-tsub</td><td style="height: 29px; width: 52.9967%;">subject</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket customer</td><td style="height: 29px; width: 15.8408%;">-tc</td><td style="height: 29px; width: 52.9967%;">customer (el customer como tal es el correo del customer registrado)</td></tr><tr style="height: 29px;"><td style="height: 29px; width: 31.1408%;">ticket note</td><td style="height: 29px; width: 15.8408%;">-tnote</td><td style="height: 29px; width: 52.9967%;">nota</td></tr></tbody></table>

**Métodos**

Get para listar, post para crear ticket, put para actualizar ticket y delete para borrar ticket .

# Crear ticket

**Argumentos necesarios**

-m (post)

-i (host)

-us y -p o -t (user y password o solo token dependiendo de la autenticación)

-tn (nombre ticket)

-tg (nombre grupo)

-tp (prioridad)

-ts (estatus)

-tsub (sujeto)

-tb (contenido)

-tt (tipo)

-tc (cliente)

-tnote (nota)

**Ejemplo ejecución manual :**

```
./pandora_zammad -m post  -i pandoraplugin -t <token> -tn "ejemplo creacion" -tg Users -tp 3 -tt note -ts 2 -tsub subject -tb "el contenido de la incidencia" -tnote nota -tc <customer>
```

**En el argumento -i (host) he puesto pandoraplugin porque el nombre de mi sitio es : https://pandoraplugin.zammad.com/**

Se creará el ticket :

[![image-1641912120586.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-01/scaled-1680-/image-1641912120586.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-01/image-1641912120586.png)

# Actualizar ticket

**Argumentos necesarios**

-m (put)

-i (host)

-us y -p o -t (user y password o solo token dependiendo de la autenticación)

-id (id ticket)

-tn (nombre ticket)

-tg (nombre grupo)

-tp (prioridad)

-ts (estatus)

-tsub (sujeto)

-tb (contenido)

-tt (tipo)

-tc (cliente)

-tnote (nota)

**Ejemplo ejecución manual** :

```
./pandora_zammad -m put -id 3  -i pandoraplugin -t <token> -tn probando123 -tg Users -tp 3 -tt note -ts 2 -tsub <subject> -tb "el contenido de la incidencia" -tnote nota -tc <email>
```

Se actualizará el ticket con esa id:

[![image-1641911410297.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-01/scaled-1680-/image-1641911410297.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-01/image-1641911410297.png)

# Eliminar ticket

Se eliminará el ticket buscando por id.

**Ejemplo con ejecución manual.**

```
./pandora_zammad -m delete  -i pandoraplugin -t <token> -id 13 
```