Issues creating an Action via API

I am having an issue with creating an action via the API. I am using the below script which I poached form a forum and modified. I keep getting an error that the Action does not exist which I kind of figured since I am trying to create it. The output from running the file is below too.

$body2 = @"
<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
    <SourcedFixletAction>
        <SourceFixlet>
            <Sitename></Sitename> 
            <FixletID>370383</FixletID>
            <Action>TempAction</Action>
        </SourceFixlet>
        <Target>
            <ComputerName>769623</ComputerName>
        </Target>
    </SourcedFixletAction>
</BES>
"@
[xml]$actions = Invoke-WebRequest -Uri "https://bigfix.spencerstuart.com:52311/api/actions" -Method Post -body $body2 -credential $creds -ErrorVariable $er

Invoke-WebRequest : {“format”:“Unexpected server error: {message}”,“arguments”:[“Action “TempAction” does not exist.”]}
At line:16 char:17

  • … ]$actions = Invoke-WebRequest -Uri "https://bigfix.spencerstuart.com: …
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Thanks!
Tony

Not sure whether it’s the only issue but I think you nees the sitename of the sourced fixlet.

Hello tlitterio,

I think, the action name <Action>TempAction</Action> inside the <SourceFixlet> is a property of a source fixlet’s action and by default it should look like:
<Action>Action1</Action

To find an actual name of a source fixlet’s action you may need to edit your fixlet and open the “Actions” tab.

For additional reference, please see https://developer.bigfix.com/rest-api/api/action.html
Note the XML example listed under POST /api/actions.

Regards,
Vitaliy

Ah, that worked! That is very misleading… Is there a comprehensive document that shows all the properties and their meanings for the BigFix API? The documentation that I’ve found at https://developer.bigfix.com/rest-api/ leaves a lot to be desired…

Thanks!