Please can someone confirm how to pass a parameter into the API URL using powershell.
I create a new Jira ticket via the API and store the response ticket ID as a powershell parameter called $jiraticketid
I then try add comment to the newly created ticket within the same powershell script, adding the ticket ID parameter into the API URL shown below in bold:
$body = "
n{
`n `"body`": `"This is a test comment within powershell`"
`n }"
$response = Invoke-RestMethod 'https://EXAMPLE.atlassian.net/rest/api/2/issue/{$jiraticketid}/comment' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
This keeps giving me a (400) bad request error message, do I need to pass the parameter as a header?
Thanks in advance Andy.