title: Post JSON data into another domain - Rest API
body: <p>I am trying to POST a data to receive an input using powershell but it's throwing error.
  Url: <a href="https://www.example.com/api/login" rel="nofollow noreferrer">https://www.example.com/api/login</a></p>
  
  <p>JSON data = {"username": "emailid", "password": "password"}</p>
  
  <p>Once the post is successful, i will receive an output in JSON format something like:</p>
  
  <p>{"account": "some-guid", "Token": "xxx", "selflink": "<a href="https://www.example.com/api/me" rel="nofollow noreferrer">https://www.example.com/api/me</a>", "username": "emailid"}</p>
  
  <p>When I am posting the JSON data, I'm getting syntax error.</p>
  
  <p>I'm using the below code to invoke </p>
  
  <pre><code>$url = "https://somedomain.com/api/login"
  
  $params = @{"username"="abcd@pqr.com";
          "password"="123456";
  }
  
  $response = Invoke-WebRequest -Uri $url -Method POST -Body $params -ContentType "application/json"
  </code></pre>