Creating outages via ReST

JohnD Blackburn <[email protected]>
Newsgroups gmane.network.opennms.general
Message-ID <DB6PR0602MB2902323957B3AD1676F6C763CB6C0@DB6PR0602MB2902.eurprd06.prod.outlook.com>
Hi All,

I've been trying to create outages via the ReST api, and am able to do so when using the numeric node id.

According to the wiki, the following code works:

$user = "admin"
$pass = "password"
$secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)

$body = '<?xml version="1.0"?>
           <outage name="Test-Outage" type="specific">
           <time day="friday" begins="10:02:00" ends="10:15:00" />
           <time begins="08-Sep-2017 10:00:00" ends="08-Sep-2017 10:15:00" />
           <node id="233" />
         </outage>'

Invoke-RestMethod -Uri "http://opennms.domain.com:8980/opennms/rest/sched-outages/" -Credential $credential -Method Post -Body $body -ContentType 'application/xml'


Which I was able to use to get a bash shell script working.  However, it would be easier for my code if I could pass in the Foreign Source and Foreign Id rather than the numeric node ID.

How do I pass in the Foreign Source and Foreign ID rather than the node id when trying to create outages via ReST?

Regards,
John

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-discuss mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.