functions/Add-Project.ps1
<#
.SYNOPSIS Create project based on name parameter .DESCRIPTION Adds a single project using teh create projet API endpoint .EXAMPLE Add-Project test Outpout (project ID) #> Function Add-Project { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string]$NewProjectName ) $uri = $CDXSERVER + "/api/projects" $JSON = ConvertTo-Json @{ name = $NewProjectName } $CreateProject = Invoke-RestMethod -Uri $uri -Method Put -Body $JSON -Headers $headers -ContentType "application/json" Write-Verbose ( $CreateProject | Format-Table | Out-String ) $CreateProject.id $CreateProject.name } |