title: Invoke-RestMethod to Pass Parameter with Value that's a Hash Table
body: <p>I've been searching high and low and trying different variations, but I can't seem to get this right.</p>
  
  <p>I'm using a RESTful API and the parameter is "log_data" and the value is a hash table @{}. I keep receiving an error from the API saying "Request body must be populated with the body parameter".</p>
  
  <p>Here's what I'm trying:</p>
  
  <pre><code>$JSONHashTable = 
  @{
  "auto_discovered"= "false"
  "coalesce_events"= "true"
  "credibility"= 5
  "description"= "Type @ SERVERNAME"
  "enabled"= "true"
  "gateway"= "false"
  "group_ids"= @(11111)
  "internal"= "true"
  "language_id"= 1
  "log_extension_id"= 153
  "name"= "Type @ SERVERNAME"
  "protocol_parameters"= @(
  @{
   id= '41040'
   name= "RootDirectory"
   value= "C:\Temp\"
  }
  @{
   id= '41060'
   name= "MonitoringAlgorithm"
   value= "Continuous Monitoring"
  }
  @{
   id= '41080'
   name= "OnlyMonitorFilesCreatedToday"
   value= "false"
  }
  @{
   id= '41100'
   name= "FileReaderPolicy"
   value= "UnicodeLogFile"
  }
  @{
   id= '41000'
   name= "identifier"
   value= "192.168.8.6"
  }
  @{
   id= '41005'
   name= "Local_System"
   value= "true"
  }
  @{
   id= '41050'
   name= "FilenamePattern"
   value= "locallog.*\.txt"
  }
  @{
   id= '41090'
   name= "FileMonitorPolicy"
   value= "FileMonitorNoFSRedirect"
  }
  @{
   id= '41120'
   name= "ThrottleTimeout"
   value= "Wi @ SERVERNAME"
  }
  @{
   id= '41110'
   name= "WinInstanceName"
   value= "5000"
  }
  )
  "protocol_type_id"= 41
  "requires_deploy"= "true"
  "store_event_payload"= "true"
  "target_collector_id"= 235
  "type_id"= 39
  "win_internal_destination_id"= 14
  }
  
  $body = @{"log_data"=$JSONHashTable} | ConvertTo-Json 
  $LogRequest = Invoke-RestMethod -Method POST -body $body -Uri $LogURI -Header @{"SEC"= $apiKey }
  </code></pre>