Translate CURL command-line to Powershell

Welcome Forums General PowerShell Q&A Translate CURL command-line to Powershell

Viewing 2 reply threads
  • Author
    Posts
    • #281939
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      Hi guys,

      I’m not able to translate the following command-line to Powershell:

      curl -X GET -H “Content-Type: application/json” -H “X-Access-Key: <token>” -d ‘{“report_time”:”monthly”,”report_type”:”summary”,”month”:”4″,”account_id”:”91ea5bd5cdc04adb9f5e3c00a346c463″}’  ‘https://<zios-address&gt;:8443/api/zios/usage_reports/generate.json’

      The problem is how to translate the parameter “-d” to the Powershell.

      Could you help me please?

      Thanks!

    • #282056
      Participant
      Topics: 4
      Replies: 425
      Points: 748
      Helping Hand
      Rank: Major Contributor

      The Invoke-RestMethod equivalent of curl’s -d is the body parameter.  I think the equivalent will be this but obviously I can’t check it works:

      Good reference guide here:

      Curl vs. PowerShell: Comparing Use Cases

      • This reply was modified 4 weeks ago by Matt Bloomfield. Reason: Formatting
    • #283339
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      Great! It’s working!

      Thank you Matt!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.