Topic
  • 7 replies
  • Latest Post - ‏2013-11-26T16:58:40Z by mcalvi91
mcalvi91
mcalvi91
37 Posts

Pinned topic api to push existing fixlet

‏2013-08-14T16:26:06Z |

Is there an API to push known fixlets to systems?  For example, i would like to push fixlet ID 1300609 in the Patches for Windows (English) site to a set of computers.  Can this be done via the rest API?

  • BrianPGreen
    BrianPGreen
    8 Posts

    Re: api to push existing fixlet

    ‏2013-08-14T18:43:07Z  

    There is not a simple way to do this.  However, it is possible to do this by GET-ing the fixlet that you want to push, constructing the action xml from that fixlet, and then POST-ing the action.

  • nberger91
    nberger91
    19 Posts

    Re: api to push existing fixlet

    ‏2013-10-29T12:45:15Z  

    Did you make progress on this, grateful if you could share ??

  • MattPeterson
    MattPeterson
    17 Posts

    Re: api to push existing fixlet

    ‏2013-10-30T14:08:22Z  

    If you know the fixlet ID and sitename you can post it as an action as follows:

     

    POST https://besserver.domain.com:52311/api/actions

    BODY:


    <?xml version="1.0" encoding="UTF-8"?>
    <BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <SourcedFixletAction>
    <SourceFixlet>
    <Sitename>Patches for Windows</Sitename>
    <FixletID>1300609</FixletID>
    <Action>Action1</Action>
    </SourceFixlet>
    <Target>
    <ComputerName>computer1</ComputerName>
    <ComputerName>computer2</ComputerName>
    </Target>
    </SourcedFixletAction>
    </BES>

     

  • nberger91
    nberger91
    19 Posts

    Re: api to push existing fixlet

    ‏2013-10-31T12:23:19Z  

    If you know the fixlet ID and sitename you can post it as an action as follows:

     

    POST https://besserver.domain.com:52311/api/actions

    BODY:


    <?xml version="1.0" encoding="UTF-8"?>
    <BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <SourcedFixletAction>
    <SourceFixlet>
    <Sitename>Patches for Windows</Sitename>
    <FixletID>1300609</FixletID>
    <Action>Action1</Action>
    </SourceFixlet>
    <Target>
    <ComputerName>computer1</ComputerName>
    <ComputerName>computer2</ComputerName>
    </Target>
    </SourcedFixletAction>
    </BES>

     

    Thanks, I got this piece working ...

    Would you happen to know where in the XML i edit to include a pre-action message ?

  • MattPeterson
    MattPeterson
    17 Posts

    Re: api to push existing fixlet

    ‏2013-10-31T14:23:41Z  
    • nberger91
    • ‏2013-10-31T12:23:19Z

    Thanks, I got this piece working ...

    Would you happen to know where in the XML i edit to include a pre-action message ?

    You could take an action in the console with the settings you want then export the action to obtain the .bes file.  That file would be our xml and would have all the action settings.  Be sure to add/change the target though, otherwise it will target ALL computers.  Using this approch would create the aciton on the fly each time, so if the content is ever updated in the console you would have to manually modify your xml to be in sync. 

    You could also try to add some of the action settings rectived from the exported .bes file and add that to the method I prevously outlined, I've never tried that, so I'm not sure if it would work.

  • nberger91
    nberger91
    19 Posts

    Re: api to push existing fixlet

    ‏2013-10-31T14:41:36Z  

    You could take an action in the console with the settings you want then export the action to obtain the .bes file.  That file would be our xml and would have all the action settings.  Be sure to add/change the target though, otherwise it will target ALL computers.  Using this approch would create the aciton on the fly each time, so if the content is ever updated in the console you would have to manually modify your xml to be in sync. 

    You could also try to add some of the action settings rectived from the exported .bes file and add that to the method I prevously outlined, I've never tried that, so I'm not sure if it would work.

    We have created an automated process that deloys relevant security hotfixes to specific machines. I cannot export an action to call via the besimport tool as the fixlet id would change on a per machine basis, meaning i would have to create hundred's of test actions.

    I've tried editing the the current xml to include a pre and/or post actions but it errors out with a format error.

     

  • MattPeterson
    MattPeterson
    17 Posts

    Re: api to push existing fixlet

    ‏2013-10-31T15:23:44Z  
    • nberger91
    • ‏2013-10-31T14:41:36Z

    We have created an automated process that deloys relevant security hotfixes to specific machines. I cannot export an action to call via the besimport tool as the fixlet id would change on a per machine basis, meaning i would have to create hundred's of test actions.

    I've tried editing the the current xml to include a pre and/or post actions but it errors out with a format error.

     

    Well, I don't know how the automated process you mentioned works...  But from what I gathered your best option may be to go the route Brian suggested.

    You do a GET to retireve the XML from a fixlet.  You could then modify that data ,and add action settings, to create a xml to post a new action.  (You would obviously want to automate this process somehow).

    Your get command would look like this:

      https://besserver.com:52311/api/fixlet/external/Patches%20for%20Windows/12.

    Maybe a better option would be to create baselines that include groups of desired fixlets.  You should then be able to modify the default behavior of that baseline to include the pre and post action stuff, then just call the baseline ID.  Your default action behavior should be taken.

    Good luck!