【问题标题】:Cannot create otrs ticket via generic interface无法通过通用接口创建 otrs 票证
【发布时间】:2017-01-17 10:00:33
【问题描述】:

我正在尝试在 otrs 系统中创建票证,但它仍然返回 301: Moved Permanetly。我正在使用 OTRS 5 免费版。

我的请求 uri:https://some.domain.com/nph-genericinterface.pl/Webservice/GenericTicketREST/Ticket

以及消息正文:

{
  "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"       

  }
}

这是我的服务配置:

---
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: ''

你能帮我解决这个问题吗?

【问题讨论】:

    标签: c# http otrs


    【解决方案1】:

    如果您收到 HTTP 301 错误,这很可能意味着您没有正确配置 Web 服务器,并且您的服务器重定向到某个位置。 OTRS 通常以200 OK500 Internal server error 响应。

    检查您的 apache 日志,看看那里发生了什么。

    我可以像这样使用curl 创建票证:

    curl "http://example.com/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=login&Password=sekret" \
    -H "Content-Type: application/json" \
    -d @create_ticket.json
    

    create_ticket.json 是这样的:

    {
       "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"
       }
    }
    

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多