ConfigItemSearch via REST

Moderator: crythias

Locked
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

ConfigItemSearch via REST

Post by RStraub »

Hello,

I'm currently trying to get the GenericInterface working with the ConfigItem Operations. Beside the confusing structure when setting up the webservice, I'm having trouble to get the ConfigItemSearch Operation to work.

My config looks like this:

Code: Select all

/Search/:UserLogin/:Password/:ConfigItem
And when I query an URL similar to this:

Code: Select all

HOSTNAME/otrs/nph-genericinterface.pl/WebserviceID/3/Search/ValidLogin/ValidPassword/Name=NameOfAConfigItem
Dumping the content of the param:

Code: Select all

$VAR1 = {
  'ConfigItem' => 'Name=NameOfAConfigItem',
  'Password' => 'ValidPassword',
  'RequestMethod' => 'GET',
  'UserLogin' => 'ValidLogin'
};
the return says:

Code: Select all

 Message: DebugLog error:  Summary: ConfigItemSearch.MissingParameter  Data   : ConfigItemSearch: ConfigItem parameter is missing or not valid!.
So I guess my problem is that I don't know how to properly encode a Hash in the URL such that the perl module receives:

Code: Select all

ConfigItem => {
	Name = Name,
	...
}
Please advice how the URL should look like, so that the ConfigItemSearch.pm accepts the parameter.

Best regards,
Rolf
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
meskobalazs
Znuny newbie
Posts: 1
Joined: 13 Sep 2018, 17:33
Znuny Version: 6.0.x
Real Name: Balázs Meskó
Company: Bravonet Kft.

Re: ConfigItemSearch via REST

Post by meskobalazs »

Hopefully this will help someone else in the future. You need to send the ConfigItem in the request body, instead of the URL itself. An example using cURL:

Code: Select all

curl "http://localhost/nph-genericinterface.pl/Webservice/WebServiceName/Search?UserLogin=LoginName&Password=Password"
-H "Content-Type: application/json" -d "{\"ConfigItem\":{\"Class\":\"Computer\"}}"
skullz
Znuny superhero
Posts: 658
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: ConfigItemSearch via REST

Post by skullz »

love to know about this one..have encounter some error..maybe like this..
end up using soap instead at the moment..
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This

Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
Locked