skip to Main Content

Json – Powershell: Using Invoke-WebRequest with variables

I am currently having a problem with a script to send fuel transactions through an api. It works without variables: $headers=@{} $headers.Add("accept", "application/json") $headers.Add("content-type", "application/json") $headers.Add("authorization", "$APIToken") $response = Invoke-WebRequest -Uri 'https://api.samsara.com/fuel-purchase' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"fuelQuantityLiters":"676.8","iftaFuelType":"Diesel","transactionLocation":"350…

VIEW QUESTION
Back To Top
Search