Reputation: 903
I'm trying to create ticket in otrs system but it still return 301: Moved Permanetly. I'm using OTRS 5 Free.
My request uri: https://some.domain.com/nph-genericinterface.pl/Webservice/GenericTicketREST/Ticket
And message body:
{
"UserLogin": "mbar",
"Password": "*****",
"Ticket" :
{
"Title": "raz dwa trzy",
"Queue": "Raw",
"Lock": "unlock",
"Type": "Unclassified",
"State": "new",
"Priority": "3 normal",
"Owner": "mbar",
"CustomerUser": "mbar"
},
"Article":
{
"Subject" : "jakiś temat",
"Body" : "test test tes test",
"ContentType": "text/plain; charset=utf8"
}
}
This is my service config:
---
Debugger:
DebugThreshold: debug
TestMode: '0'
Description: Ticket Connector REST Sample
FrameworkVersion: 4.x git
Provider:
Operation:
SessionCreate:
Description: Creates a Session
MappingInbound: {}
MappingOutbound: {}
Type: Session::SessionCreate
TicketCreate:
Description: Creates a Ticket
MappingInbound: {}
MappingOutbound: {}
Type: Ticket::TicketCreate
TicketGet:
Description: Retrieves Ticket data
MappingInbound: {}
MappingOutbound: {}
Type: Ticket::TicketGet
TicketSearch:
Description: Search for Tickets
MappingInbound: {}
MappingOutbound: {}
Type: Ticket::TicketSearch
TicketUpdate:
Description: Updates a Ticket
MappingInbound: {}
MappingOutbound: {}
Type: Ticket::TicketUpdate
Transport:
Config:
KeepAlive: ''
MaxLength: '100000000'
RouteOperationMapping:
SessionCreate:
RequestMethod:
- POST
Route: /Session
TicketCreate:
RequestMethod:
- POST
Route: /Ticket
TicketGet:
RequestMethod:
- GET
Route: /Ticket/:TicketID
TicketSearch:
RequestMethod:
- GET
Route: /Ticket
TicketUpdate:
RequestMethod:
- PATCH
Route: /Ticket/:TicketID
Type: HTTP::REST
RemoteSystem: ''
Requester:
Transport:
Type: ''
Can you help me solve this issue?
Upvotes: 2
Views: 2306
Reputation: 903
I had missing otrs in my url what was not mentioned in documentation so I changed from https://some.domain.com/nph-genericinterface.pl/Webservice/GenericTicketREST/Ticket to https://some.domain.com/otrs/nph-genericinterface.pl/Webservice/GenericTicketREST/Ticket and it works.
Upvotes: 1
Reputation: 4294
If you get an HTTP 301 error this most probably means you have not configured your web server correctly, and your server redirects to some location. OTRS typically either responds with a 200 OK
, or with a 500 Internal server error
.
Check your apache logs to see what's happening there.
I can create a ticket with curl
like this:
curl "http://example.com/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=login&Password=sekret" \
-H "Content-Type: application/json" \
-d @create_ticket.json
where create_ticket.json
would be something like this:
{
"Ticket" : {
"Queue" : "Raw",
"Priority" : "3 normal",
"CustomerUser" : "max",
"Title" : "REST Create Test",
"State" : "open",
"Type" : "Unclassified"
},
"Article" : {
"ContentType" : "text/plain; charset=utf8",
"Subject" : "Rest Create Test",
"Body" : "This is only a test"
}
}
Upvotes: 1