Hello, I am trying to trigger a task in bigfix when receiving an alert in netcool impact. I setup the RESTful api data source in Netcool and I can connect fine to the bigfix server, does any one has examples of how to make the request from Inpact, looking for parameters etc.
Some additional information or context here may be useful, but to start the discussion, in order to execute a Task (action), the POST method against /api/actions can be used (https://developer.bigfix.com/rest-api/api/action.html). In this manner, you can either define a specific actionscript to be run, or you can reference an existing Fixlet or Task. The above link has example XMLs that can be POST’d for each approach.
Hello and thank you for the help, I have seen the page you talking about it and so far Insted of posting and action to bigfix I am trying to get some information back from it as a step into the solution by using
RESTfulAPIGET(“bigfix”,“api/help”, “relevance=(names of bes computers)”);
where RESTfulAPIGET is a function retrieves resources from a RESTful API. You can use the RESTfulAPIGET function to issue HTTP GET requests to RESTful APIs.
The log below shows that I can get to the Bigfix server, but the answer I was expecting is the list of computers, but instead I am getting the word “Context” back as per log below.
The REST API endpoint that is used to evaluate and return session relevance is /api/query (https://developer.bigfix.com/rest-api/api/query.html), whereas in the log snippet above, it appears you are attempting a GET request against /api/help.
hell Aram and again thank you for your continuous help…
the RESTfulAPIGET function in netcool/impact RESTfulAPIGET(“datamodelname”, “path”, “config”)
Now I was trying to parse as above
RESTfulAPIGET(“bigfix”,“api/help”, “relevance=(names of bes computers)”);
which you rightful pointed out was wrong…however doing some more digging I found the following command works perfectly and I can log the correct answer from BigFix.
RESTfulAPIGET(“bigfix”,"/api/query?relevance=(names%20of%20bes%20computers)", “”
Noted Config part being Null
hurraaaaaaaaa!!!
what I need to figure next out is how to use the post command which reads:
RESTfulAPIPOST(“datamodelname”, “path”, “config”)
the question here is how to Add the xml string (which is the correct one (I tried to add here but the forum do not post the whole thing…
<?xml version="1.0" encoding="utf-8"?><BES SkipUI="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SingleAction>
<Title>Test Action 10</Title>
<Relevance>true</Relevance>
<ActionScript>command that I want to run</ActionScript>
<SuccessCriteria />
<Settings />
<SettingsLocks />
<Target>
<ComputerName>computername</ComputerName>
</Target>
</SingleAction>
</BES>
to the “path” part?
I tried:
path1="/api/actions"+xml;
(where xml is the whole xml string above)
result=RESTfulAPIPOST(“bigfix”, path1, Config);
But the log says that I can not connect with the bigfix server (knowing that the get command works perfectly, I can only assume that bigfix do not like the xml in the path???)
do you know when you have an xml and you want to create an action as describes in the documentation as below, where the actual xml should go?
POST/api/actionsCreates a new action.
Request: BES XML for the action.
(I edited your post to put the XML inside the “Preformatted Text” tag so the XML is readable).
You can do this by highlight your text and selecting the “Preformatted Text” option:
Your XML looks fine I think. You just put that XML in the post body. Depending on the tool your using, you do have to make sure your posting with the header Content-Type text/html; charset=UTF-8
That one threw me for a loop before I figured that one out.
Hello Roman, looking at your code made me realize that I was being crazy as I was trying to use the native language for Netcool/Impact which is IPL when in fact I could be using java as it is accepted by the tool also.
Creating the whole solution in java and following your example, I was able to create the action in bigfix and get it to execute.