AnsweredAssumed Answered

Using probe callbacks with RESTful webservice

Question asked by rrustong.1 on Nov 4, 2015
Latest reply on Apr 5, 2018 by TejeshKhimani82325243

I'm having a difficult time in properly formatting a POST request to target various probe callbacks when using the RESTful webservice.  The documentation has me a bit confused, so I'm hoping someone has gotten this to work and can explain it to me.

 

From the documentation, the "Invoke Callback" and "Invoke Callback2" API calls are to be sent as a POST with an XML or JSON formatted request.  There is one example in the documentation for invoking the get_info callback on the controller probe.  Using the example, I'm able to properly trigger the callback and get information back.

 

This is the example request that works for me:

POST /rest/probe/chris-dev/primaryhub/nb-1538/controller/callback/get_info HTTP/1.1 Accept: application/xml Content-Type: application/xml  <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <callbackrequest>      <timeout>5000</timeout>      <parameters>           <name>detail</name>           <type>int</type>           <value>1</value>      </parameters> </callbackrequest>

 

When looking at the callback in the Probe Utility, there are 2 parameters that can be sent (both are optional), but they do not align with anything in the example XML above.  The 2 possible parameters are "interfaces" and "robot".  This example works fine for any callback where I don't need to send an actual parameter, but for those that I do need/want to send a parameter, I can't work out what a proper request should look like.

 

Based on the parameters available in the Probe Utility for the controller probe, I would expect the request to look like this (and would use a similar format for other probes), but this doesn't work, so I am obviously not understanding the <parameters> section of the XML.

POST /rest/probe/chris-dev/primaryhub/nb-1538/controller/callback/get_info HTTP/1.1 Accept: application/xml Content-Type: application/xml  <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <callbackrequest>      <timeout>5000</timeout>      <parameters>           <name>interfaces</name>           <type>integer</type>           <value>1</value>      </parameters>      <parameters>           <name>robot</name>           <type>string</type>           <value>hostname</value>      </parameters> </callbackrequest>

 

Anyone know how to actually send parameters to the probe callbacks using the RESTful webservice?

Outcomes