{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Celonis Process Management REST access using Powershell","description":"API documentation for Celonis APIs.","siteUrl":"https://developer.celonis.com/","keywords":"celonis developer portal, celonis apis, celonis api reference docs","lang":"en-US","llmstxt":{"hide":false,"description":"Celonis API documentation","sections":[{"title":"API Docs","description":"Available Celonis API Docs","includeFiles":["**/*.md"],"excludeFiles":[]},{"title":"API Specs","description":"All Celonis API specifications","includeFiles":["**/openapi.yaml"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"celonis-process-management-rest-access-using-powershell","__idx":0},"children":["Celonis Process Management REST access using Powershell"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pre-requisites","__idx":1},"children":["Pre-requisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Authentication token that is active and valid"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Required parameters:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Server name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Storage collection name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Storage name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["REST authentication token"]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"executing-a-rest-command-using-powershell","__idx":2},"children":["Executing a REST command using Powershell"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["PowerShell formats the response based to the data type."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information please have a look at the documentation on Microsoft: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-6"},"children":["Microsoft documentation"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-script-to-get-released-processes-or-documents","__idx":3},"children":["Example script to get released processes or documents"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"powershell","header":{"controls":{"copy":{}}},"source":"\tfunction Fetch_Data {\n\t\t[CmdletBinding()]\n\t\t# Parameters for collecting data\n\t\tparam(\n\t\t\t# Server address parameter\n\t\t\t[Parameter(Mandatory=$true, HelpMessage=\"Please enter the server address!\", Position=1)]\n\t\t\t[ValidateNotNullOrEmpty()]\n\t\t\t[string]$address,\n\n\t\t\t# Collection name parameter\n\t\t\t[Parameter(Mandatory=$true, HelpMessage=\"Please enter the collection name!\", Position=2)]\n\t\t\t[ValidateNotNullOrEmpty()]\n\t\t\t[string]$collection,\n\n\t\t\t# Storage name parameter\n\t\t\t[Parameter(Mandatory=$true, HelpMessage=\"Please enter the storage name!\", Position=3)]\n\t\t\t[ValidateNotNullOrEmpty()]\n\t\t\t[string]$storage,\n\n\t\t\t# REST API Token parameter\n\t\t\t[Parameter(Mandatory=$true, HelpMessage=\"Please enter the REST API token!\", Position=4)]\n\t\t\t[ValidateNotNullOrEmpty()]\n\t\t\t[string]$token,\n\t\t\n\t\t\t# Export data to file parameter. False is default. Parameter is not mandatory\n\t\t\t[Parameter(Mandatory=$false, HelpMessage=\"Export result in json file?\", Position=5)]\n\t\t\t[bool]$fileExport = $false\n\t\t)\n\n\t\tProcess\n\t\t{\n\t\t\ttry\n\t\t\t{\n\t\t\t\t$params = @{\n\t\t\t\t    Uri = \"https://$($address)/$($collection)/$($storage)/_api/rest/facets/processes/views/lastReleasedProcesses/elements\"\n\t\t\t\t    Headers = @{ 'symbio-auth-token' =  $token; 'api-version' = '2.0' }\n\t\t\t\t    Method = 'GET'\n\t\t\t\t    ContentType = 'application/json'\n\t\t\t\t}\n\n\t\t\t\t# Response of the API request. Data will be taken with depth of 10 levels\n\t\t\t\t$result = Invoke-RestMethod @params | ConvertTo-Json -Depth 10\n\n\t\t\t\t# Converting from JSON to table data (Easier for customization of fields and ordering)\n\t\t\t\t$tableResult = $result | ConvertFrom-Json\n\n\t\t\t\t$valuesResult = ''\n\n\t\t\t\t# All data is putting to one table object\n\t\t\t\t$hash = @{}\n\t\t\t\tforeach($row in $tableResult.PSObject.Properties){\n\t\t\t\tif($row.Value -is [int]) { continue }\n\t\t\t\t\t$hash[$row.Name] = $row.Value\n\t\t\t\t\t$valuesResult = $hash[$row.Name]\n\t\t\t\t}\n\n\t\t\t\t$arrayOfElements = New-Object System.Collections.ArrayList\n\n\t\t\t\t# Mapping all data to fields which will be shown to the final data\n\t\t\t\tforeach($element in $valuesResult)\n\t\t\t\t{\n\t\t\t\t\t$parameters = [ordered]@{\n\t\t\t\t\t\tName = $element.attributes.Name\n\t\t\t\t\t\tState = $element.attributes.state1\n\t\t\t\t\t\tType = $element.type\n\t\t\t\t\t\tLinkAddress = $element.attributes.links.'127'.fullAddress\n\t\t\t\t\t\tLinkTitle = $element.attributes.links.'127'.title\n\t\t\t\t\t} \n\t\t\t\t\t[void]$arrayOfElements.Add($parameters)\n\t\t\t\t}\n\n\t\t\t\t# Checking if the data is not empty\n\t\t\t\tif($arrayOfElements.Count -lt 1)\n\t\t\t\t{\n\t\t\t\t\tWrite-Host \"Response returned 0 elements. Please check input parameters, and try again...\"\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n                    # If the data isn't empty, it's checking if parameter export to file is True\n                    $file_export = $fileExport\n                    $today = Get-Date -Format yyyy-MM-ddTHH-mm-ss-ff\n                    if($file_export -eq $true) \n                    {\n                        $arrayOfElements | ConvertTo-Json | Out-File \".\\processes$($today).json\"\n                    }\n                    else { $arrayOfElements | ConvertTo-Json }\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch [System.Management.Automation.CommandNotFoundException]\n\t\t\t{\n\t\t\t\tWrite-Host \"Command not found. Please execute again...\"\n\t\t\t\tWrite-Host $_.ScriptStackTrace\n\t\t\t}\n\t\t\tcatch [System.Net.WebException],[System.SystemException]\n\t\t\t{\n\t\t\t\tWrite-Host \"Web error. Please check input parameters and try again.\"\n\t\t\t\tWrite-Host $_.ScriptStackTrace\n\t\t\t}\n\t\t}\n\t}\n","lang":"powershell"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"example-output","__idx":4},"children":["Example output"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The script can output the json directly, or create a file with the same content, depending on the $fileExport parameter."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\t[\n\t\t{\n\t\t\t\"Name\":  {\n\t\t\t\t\t\t \"1033\":  \"Sub Process 1\",\n\t\t\t\t\t\t \"1031\":  \"Teilprozess 1\"\n\t\t\t\t\t },\n\t\t\t\"State\":  null,\n\t\t\t\"Type\":  \"subProcess\",\n\t\t\t\"LinkAddress\":  null,\n\t\t\t\"LinkTitle\":  null\n\t\t},\n\t\t{\n\t\t\t\"Name\":  {\n\t\t\t\t\t\t \"1033\":  \"Sub Process 2\",\n\t\t\t\t\t\t \"1031\":  \"Teilprozess 2\"\n\t\t\t\t\t },\n\t\t\t\"State\":  \"InProgress\",\n\t\t\t\"Type\":  \"subProcess\",\n\t\t\t\"LinkAddress\":  null,\n\t\t\t\"LinkTitle\":  null\n\t\t},\n\t\t{\n\t\t\t\"Name\":  {\n\t\t\t\t\t\t \"1033\":  \"Sub Process 3\",\n\t\t\t\t\t\t \"1031\":  \"Teilprozess 3\"\n\t\t\t\t\t },\n\t\t\t\"State\":  null,\n\t\t\t\"Type\":  \"subProcess\",\n\t\t\t\"LinkAddress\":  null,\n\t\t\t\"LinkTitle\":  null\n\t\t},\n\t]\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-to-call-the-powershell-script","__idx":5},"children":["How to call the Powershell script"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can save the script in a ****.ps file."," ","The parameters are:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Server name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Storage collection name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Storage name"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Authentication token"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["File export (true/false) (Optional parameter)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"running-it-with-user-input","__idx":6},"children":["Running it with user input"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When running the the script file without parameters, the script will prompt you to enter the required values. Using !? at that point will give you a hint on the required value."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"running-inline","__idx":7},"children":["Running inline"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also run the script and provide the required parameters at runtime."," ","Example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"\trun.ps -address <servername> -collection <collection-name> -storage <storage-name> -token <auth-token> -dataType 1 -fileExport false\n"},"children":[]}]},"headings":[{"value":"Celonis Process Management REST access using Powershell","id":"celonis-process-management-rest-access-using-powershell","depth":1},{"value":"Pre-requisites","id":"pre-requisites","depth":2},{"value":"Executing a REST command using Powershell","id":"executing-a-rest-command-using-powershell","depth":2},{"value":"Example script to get released processes or documents","id":"example-script-to-get-released-processes-or-documents","depth":2},{"value":"Example output","id":"example-output","depth":2},{"value":"How to call the Powershell script","id":"how-to-call-the-powershell-script","depth":2},{"value":"Running it with user input","id":"running-it-with-user-input","depth":3},{"value":"Running inline","id":"running-inline","depth":3}],"frontmatter":{"seo":{"title":"Celonis Process Management REST access using Powershell"}},"lastModified":"2026-02-26T22:05:33.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/cpm/developer/rest-api/how-to/powershell/rest-using-powershell","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}