Service Desk Practitioners Forum
cancel

Using Web API to create a new Incident

Highlighted
GunMetalGrey
Regular Contributor.

Using Web API to create a new Incident

Hi I'm very new to the whole HP SD application, but have been tasked to convert our systems from logging from InfraLite over to HP OV SD. Most of our applications are asp.net. I understand that HP OV SD is java based, and I have managed to develop a test webservice which I am able to connect to via our asp.net applications. However, is someone able to provide just a quick example for creating a new incident? I took a look at the example for creating a new problem and tried to modify it for the incident but think I've screwed up something or the server isn't configured correctly or something else. but in my eclipse console I get

"You are not allowed to insert this system incident" when I try to run on our "DEV" server

and
"Impact is: None
Priority is: None
Setting the status to Registered
Error Message: For system incident the following fields are required:

Deadline,
Impact,
Priority."

when I run it on our "TEST" server. Now I'm not sure what the exact differences are yet between the two. Things are kinda adhoc at the moment.

I've attached my file sample. Anyhelp would be greatly appreciated. Btw I'm predominantly a .net developer currently but have done a stint of Java in my previous years(been about 2 yrs now since I've touched it), so please forgive me for not being fully up to scratch with java :D..

also if someone could explain, after having looked at the sample pages on the SD, I noticed there is a option to add a new Service Call with a category of Incident, and also another option to add a new Incident (on a separate link). what is the difference betwen these two methods?..

thanks in advance

Jason
5 REPLIES
Radovan Skolnik
Acclaimed Contributor.

Re: Using Web API to create a new Incident

Having a look at your description and error message - the problem is exactly where it says it is - you have to provide values for required fields (Deadline, Impact, Priority). Just set them and it should work...
Ganesha Sridhar
Outstanding Contributor.

Re: Using Web API to create a new Incident

Hello Jason,

As stated the required fields are missing to create new incident in OVSD.
The required filed can be made optional (from the "Administrator console" ) or it can be hard coded in the template.
One more method is to use non-default template - the WEB-API uses default template,
you can change it to point to other template in your code.
The code snippet is:

// Add the Imports
/*
import com.hp.itsm.api.interfaces.ITemplate;
import com.hp.itsm.api.interfaces.ITemplateWhere;
import com.hp.itsm.api.interfaces.ITemplateHome;
*/


// Replace line 44 with the following code

ITemplateHome vITemplateHome = session.getTemplateHome();

ITemplateWhere vITemplateWhere = vITemplateHome.createTemplateWhere();
vITemplateWhere.addCriteriumOnName("
GunMetalGrey
Regular Contributor.

Re: Using Web API to create a new Incident

Ganesha

after doing further investigation.. what we are after is creating a Service Call with a category of an incident. I think I have sussed it out, but as in my other post on the forum, just wondering if this is the correct way to do things.

1)ASP.Net application authenticates User via NTLogin (eg. CORP\Joe.Bloggs)
2).Net application attempts to log call via Web Service on OV SD server, passing the NTLogin as a parameter.
3) OV SD Session is created using generic SD Account (eg. ServiceDeskTest)
4)Perform a Search on the Person Object for (Joe.Bloggs).
5) Create new service call and set the caller as the person object returned by the Joe.Bloggs search.

Am I correct in doing it this way?
Ganesha Sridhar
Outstanding Contributor.

Re: Using Web API to create a new Incident

Hello Jason,

The steps 1 to 5 is perfectly ok.

I am little bit confused over the first paragraph. The Service Call can be created only by providing the Category of Service call, but as per your statement - you are "creating a Service Call with a category of an incident".

I think we have to use Service Call Category to create Service call not the Incident Category.

Please read the OVSD WEB-API java SDK:
IServicecall
IServiceCallCategory


If you need more info please give more description on Service call - incident.

Regards
Ganesha Sridhara
GunMetalGrey
Regular Contributor.

Re: Using Web API to create a new Incident

Ganesha yes I think I should be using something like

IServiceCallCategoryHome serviceCallCategoryHome = session.getServiceCallCategoryHome();
IServiceCallCategory[] serviceCallCategories = serviceCallCategoryHome.findAllServiceCallCategory();
System.out.println("Service Category is: " + serviceCallCategories[1].getText());
servicecall.setCategory(serviceCallCategories[1]);

(just modded from the example code)
to set the service call category to "incident" I dunno whether this is the result of the way the SD admin has set it up that has caused confusion as to the terms "Incident" or whether this is native to the SD application. I've attached a screenshot showing how the service call fields are displayed in the web console.