title: How to use JSON to Powershell Invoke-RestMethod?
body: <p>I am trying to invoke the API using this request. This request is working fine in Postman. But how can I convert it to PowerShell <code>Invoke-RestMethod</code>?</p>
  
  <p>This is what I tried.</p>
  
  <pre><code>$token = "abcdef123456"
  $url = "https://example.com/OVAV1/triggercalls/1"
  $header = @{"Authorization"='abdcdef123456'}
  
  $body =
  {
  "requestid": "&lt;Echo back field&gt;",
  "templatename": "Line_Down",
  "templateid": "abcde12345",
  "noofrecords": 1,
  "variableinfo": [
  {
  "&lt;&lt;MOBILE_NUMBER&gt;&gt;": "123456789",
  "&lt;&lt;UNIQUE_CALL_IDENTIFIER&gt;&gt;": "A001",
  "&lt;&lt;LinkType&gt;&gt;": "PRI",
  "&lt;&lt;HostName&gt;&gt;": "HOSTNAME"
  }
  ]
  }
  
  $request = Invoke-RestMethod -Uri $url -Headers $header -Body $body -ContentType "application/json" -Method Post
  
  $request
  </code></pre>
  
  <p>I tried the JSON code in Postman. It's working fine. How can I use the same JSON code in PowerShell?</p>