Automic Workload Automation

 View Only

  • 1.  Using Rest API for exporting objects

    Posted Jun 11, 2026 03:44 AM

    Hi all,

    I just have a question related to exporting objects from Automic (V24) via RestAPI.

    I used the following script:

    $user = "user"
    $pass = "pass"
    
    $automicHost = "host"
    $port = "port"
    $clientNumber = "0040"
    $folderPath = "env04 - 0040"
    
    $outputFile = "C:\temp\export40.json"
    
    $credentialPair = "{0}:{1}" -f $user, $pass
    $encodedCredential = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($credentialPair))
    
    $headers = @{
        "Authorization" = "Basic $encodedCredential"
    }
    
    $encodedFolderPath = [System.Uri]::EscapeDataString($folderPath)
    
    $uri = "http://{0}:{1}/ae/api/v1/{2}/folderobjects/{3}" -f `
        $automicHost, $port, $clientNumber, $encodedFolderPath
    
    Write-Host "Calling URI:"
    Write-Host $uri
    
    try {
        Invoke-RestMethod -Uri $uri -Headers $headers -Method Get -OutFile $outputFile
        Write-Host "Successfully exported objects to $outputFile"
    }
    catch {
        Write-Error "Error during API call: $_"
    
        if ($_.Exception.Response -ne $null) {
            $stream = $_.Exception.Response.GetResponseStream()
            $reader = New-Object System.IO.StreamReader($stream)
            Write-Error $reader.ReadToEnd()
        }
    }


    The folderPath is the general folder where alle the subfolder and objects are stored. Can I export it like that? 
    When executing the script I get the following error:
    Calling URI:
    http://host:8088/ae/api/v1/0040/folderobjects/env04%20-%200040
    C:\Temp\export.ps1 : Error during API call: {
      "code" : 2004228,
      "error" : "Folder 'env04 - 0040' was not found.",
      "details" : "No detail information available."
    }
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,export.ps1
     
    C:\Temp\export.ps1 : 
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,export.ps1

    Can someone see where it fails? I do not know how to specify the folder so it can be recognized and found.

    Many thanks for your help.



  • 2.  RE: Using Rest API for exporting objects

    Broadcom Employee
    Posted Jun 12, 2026 01:56 AM
    If you want to export everything at the root level try:
     
    $folderPath = "/"
     
    Please note that big folder structures can create heavy load and cause performance decrease



  • 3.  RE: Using Rest API for exporting objects

    Posted Jun 12, 2026 06:35 AM

    Hello,

    thank you! It worked. 

    Best regards,
    Piotr