Skip to content

Instantly share code, notes, and snippets.

@VTacius
Last active May 25, 2018 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VTacius/5fd2b8559f953766ed4dec0ef4e5a140 to your computer and use it in GitHub Desktop.
Save VTacius/5fd2b8559f953766ed4dec0ef4e5a140 to your computer and use it in GitHub Desktop.
Usando la API de OSTicket

Principalmente, es posible que la use para crear tiquetes automáticamente desde un sistema de monitoreo.

Configuramos Apache para que permita al directorio api/ de OSTicket trabajar

    <Directory "/var/www/upload/api">
        AllowOverride FileInfo
    </Directory>

Reiniciamos systemctl restart apache2.service

Crear la API Key tal como se relata en este artículo que hasta tiene imágenes Using the osTicket 1.8.1.2 API

La mejor prueba posible es mediante curl. Para eso, necesitaremos un fichero de nombre tickets.json con el siguiente contenido

{
    "alert": true,
    "autorespond": true,
    "source": "API",
    "name": "Angry User",
    "email": "alortiz@salud.gob.sv",
    "phone": "7987-0505",
    "subject": "Prueba de API 2",
    "ip": "123.211.233.122",
    "message": "data:text/html,  Este es todo el mensaje que voy a enviar"
}

Y lo usamos de la siguiente forma

curl -XPOST -H 'Content-Type: application/json' -H 'X-API-Key: 001CD606140FBC1219859FE83D5DABBB' '10.20.40.45/api/tickets.json' -d @tickets.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment