Reputation: 17
I have a release pipeline in Azure DevOps. I have added an Agentless job running that calls a REST API endpoint. At the moment this works as expected. However my next challenge is to take the response from the API call and perform some tasks. Here is a breakdown of the logic I am trying to achieve:
Like I said, I have step 1 sorted but I do not know how to add the if-then-else logic
Any help appreciated Thanks
Upvotes: 0
Views: 125
Reputation: 641
You need to look at the output of your response to get your specific value.
$reponse = Invoke-RestMethod -Method GET -URI $url
$specificValue = $response.output.specificValue
if(!$specificValue) {
##value does not exist
Invoke-RestMethod -Method POST -URI $url -Body $body
}
Upvotes: 1