How to create ConfigItem by REST webservice ?

Moderator: crythias

Post Reply
sapsan
Znuny newbie
Posts: 1
Joined: 24 May 2016, 18:05
Znuny Version: 5.0.9-01
Real Name: Pavel
Company: ATC

How to create ConfigItem by REST webservice ?

Post by sapsan »

Dear colleagues,
There is a question about creation of config item by web service.
I've found the yml file GenericConfigItemConnectorSOAP.yml but this should be used by SOAP transport. By the way I tried to create my own REST yml file for REST transport. Here below is a code:
---
Debugger:
DebugThreshold: debug
TestMode: '0'
Description: ITSM Configuration Management Connector Sample
FrameworkVersion: 5.0.9
Provider:
Operation:
ConfigItemCreate:
Description: Creates new Configuration Items from ITSMConfigurationManagement
MappingInbound: {}
MappingOutbound: {}
Type: ConfigItem::ConfigItemCreate
ConfigItemGet:
Description: Get the details for Configuration Items from ITSMConfigurationManagement
MappingInbound: {}
MappingOutbound: {}
Type: ConfigItem::ConfigItemGet
ConfigItemSearch:
Description: Search Configuration Items from ITSMConfigurationManagement
MappingInbound: {}
MappingOutbound: {}
Type: ConfigItem::ConfigItemSearch
ConfigItemUpdate:
Description: Updates Configuration Items from ITSMConfigurationManagement
MappingInbound: {}
MappingOutbound: {}
Type: ConfigItem::ConfigItemUpdate
Transport:
Config:
KeepAlive: ''
MaxLength: '100000000'
RouteOperationMapping:
ConfigItemCreate:
RequestMethod:
- POST
Route: /ConfigItem
ConfigItemGet:
RequestMethod:
- GET
Route: /ConfigItemGet/:ConfigItemID
ConfigItemSearch:
RequestMethod:
- GET
Route: /ConfigItem
ConfigItemUpdate:
RequestMethod:
- PATCH
Route: /ConfigItemGet/:ConfigItemID
Type: HTTP::REST
RemoteSystem: ''
Requester:
Transport:
Type: ''

Well more over I tried to test it by curl request with the following command:
curl "http://localhost/otrs/nph-genericinterf ... mypassword" -H "Content-Type: application/json" -d "{\"ConfigItem\":{\"Class\":\"Computer\", \"Name\": \"NewTestComputer\", \"DeplState\":\"Production\",\"InciState\":\"Operational\",\"CIXMLData\":{\"Vendor\":\"Lenovo\",\"Model\":\"Thinkpad\",\"Description\":\"Thinkpadx300\",\"Type\":\"Desktop\",\"owner\":\"user\",\"NIC\":{\"NIC\":\"Eth0\",\"IPoverDHCP\":\"No\",\"IPAddress\":\"192.168.30.2\"}}}" -X POST

Unfortunantely for me an erorr has appeared "Error while decoding request content.Error while decoding request content."
So could you please to help me with this problem ?
Post Reply