Re: Create an Event via OMi API (1014 Views)
Reply
Advisor
dsalkin
Posts: 30
Registered: ‎06-07-2012
Message 1 of 7 (1,066 Views)
Accepted Solution

Create an Event via OMi API

If an error occurs in an Operations Orchestration flow I would like to create an OMi event within the flow via the OMi API (in exactly the same way as SiteScope can send an event on error).

 

I can't work out how to create this event. This is from the Operations Manager i Extensibility Guide:

 

How to Create New Events: You can create new events using the RestWsUtil command-line utility

 

But can this be done simply via the REST client without RestWsUtil? And is this the creation of a new event or a new event type?

 

Thanks,

 

David

HP Expert
Dmitry Shevchenko
Posts: 4,882
Registered: ‎01-30-2008
Message 2 of 7 (1,050 Views)

Re: Create an Event via OMi API

OMi Web Service allows to create actual events, not event types.

RestWsUtil is simply a wrapper utility and significantly simplifies using this REST API. If you prefer more complex approaches nothing prevents you from doing so. API is just API regardless of the way you use it.

 

Event Web Service Java API Documentation can be found at HPBSM/opr/api/doc/opr-external-api-javadoc.zip

Advisor
dsalkin
Posts: 30
Registered: ‎06-07-2012
Message 3 of 7 (1,033 Views)

Re: Create an Event via OMi API

Thanks. I have successfully created an event with using RestWsUtil i.e. RestWsUtil -create c:\my.xml etc, where my.xml is the same as the example in the doc:

 

<event xmlns="http://www.hp.com/2009/software/opr/data_model">
<title>My very own event</title>
<severity>normal</severity>
<priority>low</priority>
<state>open</state>
</event>

 

This worked. But I then tried to do the same thing using a REST client in Firefox. It is this which I cannot find in the documentation. Here is the URL I used:

http://our saas site/opr-console/rest/9.10/event_list/

 

I gave it the same authorization as in the RestWsUtil, added the content-type and in the body entered the same xml as above.

 

Is this the correct form of the URL and body?

 

(I get a 403 access is denied error. I do have permissions though and they are the same as in the RestWsUtil call).

 

Regards,

 

David

HP Expert
Dmitry Shevchenko
Posts: 4,882
Registered: ‎01-30-2008
Message 4 of 7 (1,030 Views)

Re: Create an Event via OMi API

Do you set X-Secure-Modify-Token HTTP header?

If not, did you disable 

Infrastructure Settings > Applications = Operations Management

Operations Management - Web Service Settings > Secure Modify?

Advisor
dsalkin
Posts: 30
Registered: ‎06-07-2012
Message 5 of 7 (1,014 Views)

Re: Create an Event via OMi API

I did not set this header.
Thanks for the great support Dmitry
Advisor
Wazr
Posts: 21
Registered: ‎04-10-2011
Message 6 of 7 (600 Views)

Re: Create an Event via OMi API

Hi Dmitry,

 

Thanks for that, however if you want to keep the web service security enabled, how do I know what to set X-Secure-Modify to?  The BSM/OMi Extensibility document appears to give no hints on what it should be.

 

Thanks heaps,

Warren

HP Expert
Dmitry Shevchenko
Posts: 4,882
Registered: ‎01-30-2008
Message 7 of 7 (595 Views)

Re: Create an Event via OMi API

Please check the Extensibility guide again, it's more than clear on that subject. Here is a quote:

 

Web Service clients must first obtain the secureModifyToken cookie, and then set the value of the cookie in the

X-Secure-Modify-Token HTTP header.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.