OTRS REST Java客户端

hea*_*ach 1 java client web-services otrs

有人知道一个好的Java客户端OTRS或者我可以指向一些信息页面来编写我自己的客户端吗?我对OTRS完全不熟悉,但我听说有一个外部接口(Webservice)来完成大部分OTRS与java REST客户端的工作.

有人可以链接一些信息页面吗?也许一个例子如何使用OTRS创建REST WS以及一些curl示例如何使用它?

已找到链接:

  1. https://github.com/gtudan/OTRS-Client - >维护水平低
  2. https://www.otrs.com/otrs-help-desk-software-unterstuetzt-jetzt-rest/?lang=de
  3. http://otrs.github.io/doc/manual/admin/stable/en/html/genericinterface.htmls
  4. ...

我用这个yaml文件创建了一个web服务:

---
Debugger:
  DebugThreshold: debug
  TestMode: '0'
Description: The description of WS
FrameworkVersion: 4.0.5
Provider:
  Operation:
    TicketGet:
      Description: ''
      MappingInbound:
        Type: Simple
      MappingOutbound:
        Type: Simple
      Type: Ticket::TicketGet
  Transport:
    Config:
      KeepAlive: ''
      MaxLength: '20000000'
      RouteOperationMapping:
        TicketGet:
          Route: /Ticket/:TicketID
    Type: HTTP::REST
RemoteSystem: ''
Requester:
  Transport:
    Type: ''
Run Code Online (Sandbox Code Playgroud)

然后我尝试卷曲到WS:

curl -i -H "Content-Type: application/json" -d {UserLogin:"user",Password="userpass",Ticket={Title="test"}} http://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Ticket/1
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

hea*_*ach 5

首先,重要的是如何命名Web服务.我选择'测试'.导入此yml或创建自己的WS,导出配置yml并将其更改为以下内容.保存更改并重新导入此文件.

---
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
  Transport:
    Config:
      KeepAlive: ''
      MaxLength: '20000000'
      RouteOperationMapping:
        TicketGet:
          Route: /TicketGet/:TicketID
        TicketUpdate:
          RequestMethod:
          - POST
          Route: /TicketUpdate/:TicketID
    Type: HTTP::REST
RemoteSystem: ''
Requester:
  Transport:
    Type: ''
Run Code Online (Sandbox Code Playgroud)

然后检查具有ticketID 1的票证是否存在,并带有一些示例标题,如"first Title".

然后使用这个卷曲:

curl -X POST -i -H "content-type: application/json" -d '{"UserLogin": "user", "Ticket": {"Title": "changeme"}, "Password": "userpass"}' "http://localhost/otrs/nph-genericinterface.pl/Webservice/Test/TicketUpdate/1"
Run Code Online (Sandbox Code Playgroud)

如果您将WS命名为"Test123xy",则重命名curl url

".../Webservice/Test/..." 
Run Code Online (Sandbox Code Playgroud)

".../Webservice/Test123xy/..."
Run Code Online (Sandbox Code Playgroud)

现在它对我有用.