The Groovy api object is used by Groovy scripts to access the 1Gateway message bus.


 

Method

Purpose

Example

publish(data[,messagetype][,splitArrays])

Publish data as message. Supported data formats are listed below. SplitArrays is a Boolean indicating whether or not json array data should be split into multiple messages.

api.publish(“Hello world”)

parse(data[,messagetype][,splitArrays])

Parses data and returns it as a message without publishing.


newMessage(messagetype)

Create an empty message

 

sendAlarm(ci,element,elementtype,text,suppression,severity)

Sends a normalized alarm

 

sendMetric(ci,element,elementtype,metrictype,value)

Sends a normalized metric

 

getAuth(name)Retrieves configured credentials by name
setMessageType(string)Sets the default message type for subsequent calls to parse and publish.
wto(string)Write To Operator: any text passed to this method will be visible in the 1Gateway portal and in the log
addIdmap(ep1,id1,ep2,id2)Create an id mapping association between endpoint ep1 id id1 and endpoint ep2 id id2.