RS4OTRS_API
About
RS4OTRS_API package is used for communication with OTRS server.
Installation
-
Install the JSON API package version 6.41.0 or later on the OTRS6 server.
-
In the zzz_otrs.conf file (documentation link) inside section <Location /otrs> you should write:
RewriteEngine on
RewriteRule "/api/(\w+)/(\w+)" "/otrs/json.pl?Action=$1&Subaction=$2" [QSA,L]
- Restart Apache.
HTTP communication
API supports GET and POST HTTP requests, but for security reason you should use only POST ones with JSON body (application/json).
Auth token and permissions
Almost all methods require a special token. It can be taken from /auth/login call.
Without a token or with incorrect one you get an error:
{
"Response": "ERROR",
"Message": "Session invalid. Please log in again."
}
Some methods are checked for user permissions (Agent groups permissions). For such calls there is a field ``Need permissions’’ with group permissions list in this manual.
Error response
Except ``Session invalid.’’ there is also another common error response:
{
"Message": "Please contact the administrator.",
"Response": "ERROR"
}
which says that the problem is non-presumable for such case.
Request examples
POST request for /auth/login:
curl -s -X POST
-H 'Content-Type: application/json' localhost/otrs/api/auth/login
-d '{"User":"root@localhost", "Password": "kBHsn6"}'
GET request:
curl -s -X GET
"localhost/bin/api/auth/login?User=root@localhost&Password=kBHsn6"
Methods list
/auth
/customers
/filters
/queues
/services
/settings
/sla
/system
/tickets
- /createArticle
- /createAttachment
- /createTicket
- /getArticles
- /getAttachment
- /getTicketList
- /markArticleAsSeen
- /markTicketAsSeen
- /updateArchiveFlag
- /updateCustomer
- /updateLock
- /updateOwner
- /updatePendingTime
- /updatePriority
- /updateQueue
- /updateResponsible
- /updateService
- /updateSLA
- /updateState
- /updateTicket
- /updateTitle
- /updateType
- /watchTicket