public/api-v2/issue/Invoke-JiraCreateIssue.ps1
#https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-post function Invoke-JiraCreateIssue { [CmdletBinding()] param ( # Used to make simple updates to fields on this issue [Parameter(Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)] [hashtable] $Fields, # Used to make complex updates to issue fields [Parameter(Position=1,ValueFromPipelineByPropertyName)] [hashtable] $Update, # ID of a Transition to apply [Parameter(Position=2,ValueFromPipelineByPropertyName)] [int32] $TransitionId, # Optional history metadata [Parameter(Position=3,ValueFromPipelineByPropertyName)] [hashtable] $HistoryMetadata, # Add/set arbitrary issue properties [Parameter(Position=4,ValueFromPipelineByPropertyName)] [hashtable] $Properties, # Indicates whether the creating user's history should be updated to show the project the issue is created in [Parameter(Position=5,ValueFromPipelineByPropertyName)] [Switch] $UpdateUserHistory, # Disables issue notifications for this update [Parameter(Position=6,ValueFromPipelineByPropertyName)] [Switch] $DisableNotifications, # The JiraConnection object to use for the request [Parameter(Position=7)] [hashtable] $JiraConnection ) begin { $results = @() } process { $functionPath = "/rest/api/2/issue" $verb = "POST" $query = @{} if($PSBoundParameters.ContainsKey("UpdateUserHistory")){$body.Add("updateHistory",$true)} $body=@{} if($PSBoundParameters.ContainsKey("DisableNotifications")){$body.Add("notifyUsers",$false)} if($PSBoundParameters.ContainsKey("TransitionId")){$body.Add("transition",@{id="$TransitionId"})} if($PSBoundParameters.ContainsKey("Fields")){$body.Add("fields",$Fields)} if($PSBoundParameters.ContainsKey("Update")){$body.Add("update",$Update)} if($PSBoundParameters.ContainsKey("HistoryMetadata")){$body.Add("historyMetadata",$HistoryMetadata)} if($PSBoundParameters.ContainsKey("Properties")){$body.Add("properties",$Properties)} $results += Invoke-JiraRestMethod $JiraConnection $functionPath $verb -Query $query -Body $body } end { $results } } |