OTRS is a tool to log tickets online. This is very basic requirement to log tickets and track them online. OTRS gives this functionality but if you want to integrate this functionality in you application then OTRS provide you with some basic API's like to create ticket, get ticket by id, update ticket, search ticket. Please follow below screenshots to enable in it your OTRS tool. Here we are assuming that OTRS tool is already installed.
3. Find WebService link as:
4. Click on WebService.
5. Click on "add web service".
6. Click on "Import web service" and choose file from desktop (use Test.yaml file given below)
Test.yaml file
---
Debugger:
DebugThreshold: debug
TestMode: '0'
Description: Is used by me
FrameworkVersion: 4.0.5
Provider:
Operation:
TicketGet:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketGet
TicketUpdate:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketUpdate
TicketCreate:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketCreate
TicketSearch:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketSearch
Transport:
Config:
KeepAlive: ''
MaxLength: '20000000'
RouteOperationMapping:
TicketGet:
Route: /TicketGet/:TicketID
TicketUpdate:
RequestMethod:
- POST
Route: /TicketUpdate/:TicketID
TicketCreate:
RequestMethod:
- POST
Route: /TicketCreate
TicketSearch:
RequestMethod:
- GET
Route: /TicketSearch
Type: HTTP::REST
RemoteSystem: ''
Requester:
Transport:
Type: ''
It will expose the web service and you can test it with any client tool like POSTMAN etc
You need to add parameter user name as UserLogin and password as password to access any api.
Example of get API (GET)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketGet/Ticketno?UserLogin=username&Password=password
Example of Create API (POST)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketCreate?UserLogin=user name&Password=password
JSON in Body as:
{
"Ticket" : {
"QueueID" : "1",
"PriorityID" : "5",
"CustomerUser" : "email id",
"Title" : "REST Create Test",
"State" : "open"
},
"Article" : {
"ContentType" : "text/plain; charset=utf8",
"Subject" : "Rest Create Test",
"Body" : "This is only a test"
}
}
Example of update API (POST)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketUpdate/22645?UserLogin=user login&Password=password
JSON in Body as:
{
"Ticket" : {
"QueueID" : "1",
"PriorityID" : "5",
"CustomerUser" : "email id",
"Title" : "REST Create Test",
"State" : "open"
},
"Article" : {
"ContentType" : "text/plain; charset=utf8",
"Subject" : "Rest Create Test Update",
"Body" : "This is only a test updated"
}
}
Example of searc API
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketSearch?UserLogin=user name&Password=password
- Login in OTRS with admin user.
3. Find WebService link as:
4. Click on WebService.
5. Click on "add web service".
6. Click on "Import web service" and choose file from desktop (use Test.yaml file given below)
Test.yaml file
---
Debugger:
DebugThreshold: debug
TestMode: '0'
Description: Is used by me
FrameworkVersion: 4.0.5
Provider:
Operation:
TicketGet:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketGet
TicketUpdate:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketUpdate
TicketCreate:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketCreate
TicketSearch:
Description: ''
MappingInbound:
Type: Simple
MappingOutbound:
Type: Simple
Type: Ticket::TicketSearch
Transport:
Config:
KeepAlive: ''
MaxLength: '20000000'
RouteOperationMapping:
TicketGet:
Route: /TicketGet/:TicketID
TicketUpdate:
RequestMethod:
- POST
Route: /TicketUpdate/:TicketID
TicketCreate:
RequestMethod:
- POST
Route: /TicketCreate
TicketSearch:
RequestMethod:
- GET
Route: /TicketSearch
Type: HTTP::REST
RemoteSystem: ''
Requester:
Transport:
Type: ''
It will expose the web service and you can test it with any client tool like POSTMAN etc
You need to add parameter user name as UserLogin and password as password to access any api.
Example of get API (GET)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketGet/Ticketno?UserLogin=username&Password=password
Example of Create API (POST)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketCreate?UserLogin=user name&Password=password
JSON in Body as:
{
"Ticket" : {
"QueueID" : "1",
"PriorityID" : "5",
"CustomerUser" : "email id",
"Title" : "REST Create Test",
"State" : "open"
},
"Article" : {
"ContentType" : "text/plain; charset=utf8",
"Subject" : "Rest Create Test",
"Body" : "This is only a test"
}
}
Example of update API (POST)
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketUpdate/22645?UserLogin=user login&Password=password
JSON in Body as:
{
"Ticket" : {
"QueueID" : "1",
"PriorityID" : "5",
"CustomerUser" : "email id",
"Title" : "REST Create Test",
"State" : "open"
},
"Article" : {
"ContentType" : "text/plain; charset=utf8",
"Subject" : "Rest Create Test Update",
"Body" : "This is only a test updated"
}
}
Example of searc API
http://server address/otrs/nph-genericinterface.pl/Webservice/Test/TicketSearch?UserLogin=user name&Password=password
No comments:
Post a Comment