Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

WEB-API - ADDING MULTI Categories

SOLVED
Go to solution
Highlighted
Michael Hamelra
Occasional Contributor

WEB-API - ADDING MULTI Categories

I am developing an java application using the webapi. I have spent over 15 hrs of research and still nothing.: MANY OTHER PEOPLE are have the same issue; I need to utilize the "OR" similar to the
addContainCriteriumOnSearchcode... I know ICICategory is Not TEXT.

How can I do this below utilizing
---------------------------
category = "Linux" OR "Unix or "Wintell"


Utilizing:
addCriteriumOnCategory(ICICategory value);



-----------CODE OVERVIEW -------------
IConfigurationItemWhere ciListWhere = session.getConfigurationItemHome().createConfigurationItemWhere();
ciListWhere.addCriteriumOnSearchcode(String value);
ciListWhere.addCriteriumOnCategory(ICICategory value);
IConfigurationItem ciList = session.getConfigurationItemHome().findConfigurationItem( ciListWhere );


9 REPLIES
The Pike
Honored Contributor

Re: WEB-API - ADDING MULTI Categories

not clear if your question is how to use an OR operator with a String value (not a Service Desk question)

OR (pun intended)

how to add a contain criterium on the code's String value.
Michael Hamelra
Occasional Contributor

Re: WEB-API - ADDING MULTI Categories

The Question Is:
addCriteriumOnCategory takes ONE argument.

There is no way to add a "OR" into something like this below:

ICICategory category = "Linux" OR "Unix or "Wintell"

ciListWhere.addCriteriumOnCategory(category);

NOTE **** YOU CAN NOT DO Multi Caregory seraches...even if I set the ICICategory category correctly.


ciListWhere.addCriteriumOnCategory(category1);
ciListWhere.addCriteriumOnCategory(category2);

----------------------
How do I CODE a : addContainCriteriumOnCategory(ICICategory value);

I realize it is not Text... but rather :

The attributes is either has a simple Java type, or references another entity, that has an ordering attribute.



Michael Hamelra
Occasional Contributor

Re: WEB-API - ADDING MULTI Categories

I sorry...Its just that if you use the Abvance find in OVSD Sevice Desk - F2 - Configuration Item:
You can Build This: Category = UNIX OR LINUX

I realize that SERVICE DESK its retieveing and building Catogory lookup window. but the end results is:
[Catogory] [equals] [ UNIX OR LINUX]
-------------------------
I have read many People's REQUEST and they can not figure this out ... the 6 or 8 examples PROGRAMS that come with the HP OpenView Service Desk 4.5
Web API Programmerâ s Guide only adddress Range or Text or a Single object:
Michael Hamelra
Occasional Contributor

Re: WEB-API - ADDING MULTI Categories

I've read someones response about utilizing API's from HP OpenView Service Desk 4.0
API Programmerâ s Guide.... I believe the answer is Not to look backwards.... but to disclose how to do it now utilizing Web-API 4.5
Radovan Skolnik
Honored Contributor

Re: WEB-API - ADDING MULTI Categories

The response was mine probably - I recently posted answer to the same question.

There simply is no OR functionality in WEB-API. All the criteria is added as AND. Disappoints on HP especially when the backend API supports AND, OR, NOT, BETWEEN and some other operators and it would be very simple to add it to WEB-API which is a thin layer on top the backend (native) API.

I could hack a support for it in WEB-API if someone was willing to pay for the effort.

Michael Hamelra
Occasional Contributor

Re: WEB-API - ADDING MULTI Categories

Thank you for your all your insight:
I have to ask One Questtion:
Why is it that Our Company HP can do it From Within Service Desk 4.5 UTILIZING a "Advance Find"?

Try it:
Configuration Item:
Select Category or RU Reporting Status:
I have read the API 4.0 Guide... 3 times: I get it. The problem is translating it into Web-Api 4.5.

The answer is to get a hold of the Java Developer who build the Advance Find...

Note*** Most Developers ... just give up...with respect... I will not...it can be done...this I know...its just a matter of knocking on the right doors or just another 20 hours os coding ...whaterver comes first.

I have read at least 10 differnet requests upbout this type of Issue...




Radovan Skolnik
Honored Contributor
Solution

Re: WEB-API - ADDING MULTI Categories

Michael,

it is not possible to translate what Advanced Find does to WEB-API because Advanced Find uses internal API (4.0 style you read about). The reason is WEB-API is a layer built on top of internal APIs but exposes only some of its functionalities. I.e. when using WEB-API the flow of code is like this:

APP->WEB-API->internal_API

The flow of Advanced Find is like this:
SD GUI->internal_API

So only what is exposed by WEB-API can be translated into internal API. And because there aren't operators (other than implicit AND) exposed they cannot be translated. Also there are no appropriate objects for constructing the search compound. That's why without actually adding code to WEB-API it cannot be done...
Michael Hamelra
Occasional Contributor

Re: WEB-API - ADDING MULTI Categories

Thank you [Radovan Skolnik] for your detail explanation about translating â Advanced Findâ
to WEB-API . Your knowledge and expertise is greatly appreciated!!!

My work-around would be to gather a large scope of records and drill down
or generate several small searches.

Question: Can HP Server Pages generate a detail query similar to â Advance Findâ and export the results to a CSV file.

Question: Or do you have a better idea?

I believe it would be safe to say: That Service Desk 5.xx and Its web-api has not addressed the â addContainCriteriumOnâ Issue for Category (or) ICICode17 .

I will say: I was impressed with the web-api as a whole. Its just that they had the functionality in place web-api 4.0.
They were so close and had the talent to make it happen.
Once again â thank you for all your support ... also to â [The Pike]â .
Radovan Skolnik
Honored Contributor

Re: WEB-API - ADDING MULTI Categories

To simulate OR functionality for an expression like (A OR B OR C) you can do 3 separate searches for A, B and C respectively and combine the results of them to eliminate duplicates.

What do you mean by "Question: Can HP Server Pages generate a detail query similar to â  Advance Findâ  and export the results to a CSV file."

You mean Service Pages? The answer would be no - it uses WEB-API so all it does is what you can do directly.

As I wrote earlier: it wouldn't be that difficult (surely not for HP) to add requested functionality to WEB-API. I would be able to do it if someone was willing to pay for that. Speaking of such things - please have a look at these tools I created for ServiceDesk:

http://www.skolnik.info/sdutils/sso/
http://www.skolnik.info/sdutils/sftp/
http://www.skolnik.info/sdutils/ldap/

Best regards

Radovan
//Add this to "OnDomLoad" event