How can I add an Article via WebService?

Moderator: crythias

Post Reply
nouphet
Znuny newbie
Posts: 36
Joined: 21 Mar 2014, 11:04
Znuny Version: 5.0.17
Real Name: Toshihiro Takehara
Company: Craftsman Software Inc.
Location: Japan
Contact:

How can I add an Article via WebService?

Post by nouphet »

Hi Dear,

How can I add an Article via WebService?

I am using OTRS 5.0.17.
We set WebService with json so that we can add new tickets and close them.

However, I do not know how to add Article.
Can anyone tell me?


My settings is below.

WebServiceAPI001.yml

Code: Select all

---
Debugger:
  DebugThreshold: debug
  TestMode: 0
Description: ウェブサービスAPI 001
FrameworkVersion: 5.0.17
Provider:
  Operation:
    RemoteTicketCreate:
      Description: 作成
      MappingInbound:
        Type: Simple
      MappingOutbound:
        Type: Simple
      Type: Ticket::TicketCreate
    RemoteTicketUpdate:
      Description: update
      MappingInbound:
        Type: Simple
      MappingOutbound:
        Type: Simple
      Type: Ticket::TicketUpdate
  Transport:
    Config:
      KeepAlive: ''
      MaxLength: '1000000'
      RouteOperationMapping:
        RemoteTicketCreate:
          RequestMethod:
          - POST
          Route: /RemoteTicketCreate
        RemoteTicketUpdate:
          RequestMethod:
          - PATCH
          Route: /RemoteTicketUpdate/:TicketID
    Type: HTTP::REST
RemoteSystem: Zabbix or something
Requester:
  Transport:
    Type: ''
Thank you.
Regards,
OTRS 5.0.17 running on CentOS 7.2, Apache 2.4, MariaDB Server 5.5
nouphet
Znuny newbie
Posts: 36
Joined: 21 Mar 2014, 11:04
Znuny Version: 5.0.17
Real Name: Toshihiro Takehara
Company: Craftsman Software Inc.
Location: Japan
Contact:

Re: How can I add an Article via WebService?

Post by nouphet »

Hi,

I solved myself this issue. :D

I will report how to solve it.
The result is like this.

1. The first code of this problem.

Code: Select all

## Update
curl -X "PATCH" "http://<your-domain>/otrs/nph-genericinterface.pl/Webservice/WebServiceAPI001/RemoteTicketUpdate/50?UserLogin=otrs5-admin&Password=password" \
     -H "Content-Type: application/json" \
     -d $'{
  "Ticket": {
    "State": "closed successful",
    "Queue": "Raw",
    "Article": {
      "Subject": "fuga",
      "Body": "fugafuga",
      "ContentType": "text/plain; charset=utf8"
    }
  }'
2. The solved version here

Code: Select all

## Update
curl -X "PATCH" "http://<your-domain>/otrs/nph-genericinterface.pl/Webservice/WebServiceAPI001/RemoteTicketUpdate/50?UserLogin=otrs5-admin&Password=password" \
     -H "Content-Type: application/json" \
     -d $'{
  "Ticket": {
    "State": "closed successful",
    "Queue": "Raw",
    "Article": {
      "Subject": "fuga",
      "Body": "fugafuga",
      "ContentType": "text/plain; charset=utf8"
    }
  },
  "Article": {
    "Subject": "closed いいい",
    "Body": "closed いいいいい",
    "ContentType": "text/plain; charset=utf8"
  }
}'
Thank you very much. :)
Best.
OTRS 5.0.17 running on CentOS 7.2, Apache 2.4, MariaDB Server 5.5
Post Reply