functions/Add-Project.ps1
<#
.SYNOPSIS Create project based on name parameter .DESCRIPTION Adds a single project using the create projet API endpoint. Returns an array containing Project ID and project name. .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 ) Return $createProject #$CreateProject.id #$CreateProject.name } |