Kelemvor
2 years agoExpert
Powershell: Expanding a variable inside single quotes to make an API call
Hi, I’m trying to use Powershell to make an API call and pass in the SDT start/end time as a variable. However, because the call has to be within single quotes, I can’t get it to expand the variabl...
- 2 years ago
It might be easier to build up the body of your API call in a variable and then pass it in. So something like this:
$body = '{"sdtType":1,"type":"DeviceSDT","deviceId":13771,"startDateTime":’ + $now + ‘,"endDateTime":’ + $later + ‘}'
Then use the $body variable in your API call.
Dave