07-21-2023, 08:55 PM
I need to send a simple string to a web api using Powershell, and I have to ensure the value in the HTML body has "Quotes" around it, because the content type has to be application/json.
For example:
$specialKey = "101010"
Invoke-RestMethod -Method Put `
-Uri $keyAssignmentUri `
-Header @{"content-type"="application/json"} `
-Body "$specialKey"
When I inspect this call in Fiddler, I see that the body is 101010 instead of "101010". How do I send the body value with quotes?
For example:
$specialKey = "101010"
Invoke-RestMethod -Method Put `
-Uri $keyAssignmentUri `
-Header @{"content-type"="application/json"} `
-Body "$specialKey"
When I inspect this call in Fiddler, I see that the body is 101010 instead of "101010". How do I send the body value with quotes?