cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2247
Views
0
Helpful
2
Replies

Macro Creation - Making API calls

r4yfx
Level 1
Level 1

Hi 

 

I have been looking into the following github module and been trying to see if we could integrate this using an API call to icigna2 to let us know that rooms etc are having audio/video issues or needs attention as specified in the module. 

 

However, attempting to integrate this using either the fetch command or using  XMLHttpRequest is throwing up errors within the macro. Stating; "ReferenceError: identifier 'XMLHttpRequest' undefined" or similar error for fetch. 

 

Does anyone have any working examples for making API calls from the macros? 

 

Thanks

2 Replies 2

r4yfx
Level 1
Level 1

I "think" I have found a way of doing this, but it appears that I am getting an invalid SSL cert. 

 

ReportIssue'Unhandled promise rejection' { code: 0, message: 'HttpClientPostResult', data: { status: 'Error', Message: 'SSL peer certificate or SSH remote key was not OK' } }

 

function sendMonitoringUpdatePost(message){
  
     xapi.command('HttpClient Post', { 'Header': 'Content-Type: application/json', 'Url':MONITORING_URL}
     , JSON.stringify(Object.assign({'Message': message}, systemInfo)));
}

dstaudt
Cisco Employee
Cisco Employee

There are configurations/processes for either importing the target certificate (production) or disabling the cert check (development), see this learning lab for details: https://developer.cisco.com/learning/lab/collab-xapi-macros/step/4