c# - 无法通过通用接口(interface)创建 otrs 票证

标签 c# http otrs

我正在尝试在 otrs 系统中创建票证,但它仍然返回 301:永久移动。我正在使用 OTRS 5 Free。

我的请求 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: ''

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

最佳答案

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

检查您的 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"
   }
}

关于c# - 无法通过通用接口(interface)创建 otrs 票证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39408397/

相关文章:

c# - 带有 IOC : "The current type is an interface and cannot be constructed" 的身份框架

c# - 使用更改的默认打印机设置打印 PDF

c# - 正确的锁定模式

java - 浏览器如何处理 HttpServletResponse

windows - 在 WebDAV 响应中显示错误描述

php - 使用 soap api 显示所有 otrs 票

c# - 动态 Linq : How to specify the StringComparison type?

.net - HTTP 400 : detected invalid characters in the URL. IIS 解码 URL 过早?这里发生了什么?

otrs - 如何从外部服务向 OTRS 发送数据