0

API Call From Outbound Integration

I have an outbound integration that is triggered by the submission of a form via the xMatters portal.  This outbound integration parses the content from the form, executes some business logic and then makes an API call to an inbound integration to send an alert.

The downside is that I end up with two events.  The one that is created when the form is submitted and the one that is created by the call to the inbound integration.  I would like to add some code at the end of the outbound integration to automatically terminate the first event (the one created by the form).  I assume the best way to do that is call the event API to change the status of the event but I can't seem to get it to work.  Tried fetch and AJAX and neither works.  Google seems to have run out of ideas.  Anybody have any suggestions?

This is the most recent code that didn't work.

 

var eventID = payload.eventIdentifier;

fetch('https://ourUrl.com/api/xm/1/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({id: eventID,status: 'TERMINATED'})
});

 

 

10 comments

Please sign in to leave a comment.