Receiving event creation failed message when attempting to create an event using the RESTful API.
The catalina.out file references error NO_USER. I have attempted using 2 different users against an EventAdmin and EventModel. One of the users is the install user. I've also tried issuing the post with the required data in the xml body and as a part of the url. Every attempt results in the same NO_USER error in the catalina.out.
The url attempt: http://<OC_Host>:8080/spectrum/restful/events/0xfff01840/model/0x600105
The url and xml attempt: http://<OC_Host>:8080/spectrum/restful/events
<rs:event-request xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throttlesize="10000" xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd">
<rs:event>
<rs:target-models>
<rs:model mh="0x600104"/>
</rs:target-models>
<rs:event-type id="0xfff01840"/>
<rs:varbind id="1">test</rs:varbind>
<rs:varbind id="2">1234</rs:varbind>
</rs:event>
</rs:event-request>
In the catalina.out file:
Jan 26, 2022 14:48:10.319 - Error in createEvent for mh 0x600107,event -1042368 : exception com.aprisma.spectrum.core.idl.CsCException.CsCSpectrumException {
com.aprisma.spectrum.core.idl.CsCError.CsCError_e error=NO_USER,
java.lang.String messageFormatID="CsCModelDomain.createEvent.user.domain.NO_USER",
com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue[] messageValueList={union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="CsModelDomSrvc.cc"
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="%I% %G% %U%"
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
int intValue=6011
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="ca-spectrum"
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
int intValue=13
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="ca-spectrum"
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="(unknown_user)"
},union com.aprisma.spectrum.core.idl.CsCAttribute.CsCValue {
java.lang.String textString="ca-oneclick"
}}
}
Release : 20.2
Component : Spectrum OneClick
The account does not exist on the remote landscape.
The account used in the RESTful API was not created on the remote landscape. After deleting the account and recreating it the problem was resolved as it was synchronized across landscapes.
1. I created the event-alarm.xml file with the following entries on the OC host:
<?xml version="1.0" encoding="UTF-8"?>
<rs:event-request throttlesize="10"
xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd">
<rs:event>
<!-- target model of event -->
<rs:target-models>
<rs:model mh="0x600107"/>
</rs:target-models>
<!-- event ID -->
<rs:event-type id="0xfff01840"/>
<!-- attributes/varbinds -->
<rs:varbind id="1">test</rs:varbind>
<rs:varbind id="2">1234</rs:varbind>
</rs:event>
</rs:event-request>
2. As my Spectrum is in Windows platform, I download the curl for Windows (https://curl.se/windows/)
3. Then I ran the following syntax:
curl -s -H "Content-Type: application/xml" -u spectrum:spectrum -d @event-alarm.xml "http://localhost/spectrum/restful/events"
curl -s -H "Content-Type: application/xml" -u "spectrum:spectrum" -d @event-alarm.xml "http://localhost/spectrum/restful/events"
curl -s -v -H "Content-Type: application/xml" -u spectrum:spectrum -d @event-alarm.xml "http://localhost/spectrum/restful/events"
Where spectrum:spectrum is the username and password and -v is the verbose mode. You may need to put the username and password in between double quotes (") if there is any special character.
4. The event/alarm was successfully generated on the EventModel: