Forum Discussion

ChrisSchroeder's avatar
ChrisSchroeder
Copper Contributor
Mar 19, 2021
Solved

Passing information to API, works in CURL, not in PS7

This API call to a Cisco Firepower 1120 works in CURL (on Ubuntu)... please note credentials and host name have been obfuscated here but are correct in the original versions:   curl --cacert fwcert...
  • AndySvints's avatar
    Mar 19, 2021

    Hello ChrisSchroeder,

    I think you are missing -ContentType parameter:

    If this parameter is omitted and the request method is POST, Invoke-RestMethod sets the content type to application/x-www-form-urlencoded.

     

     

    Invoke-RestMethod -Uri $fwurl -Method POST -SkipCertificateCheck -Body $param -Content 'application/json'

     

     

    Reference: Invoke-RestMethod

    Hope that helps.

Resources