Coder Social home page Coder Social logo

curl2ps's Introduction

Curl2PS

My goal with this repo is be able to easily convert curl commands to Invoke-RestMethod syntax for PowerShell consumption.

Currently, it is a simple function, ConvertTo-IRM, that works with simple curl examples such as:

$CurlString = @"
curl -H "X-Auth-Key: 61e5f04ca1794253ed17e6bb986c1702" -H "X-Auth-Workspace: [email protected]" -H "X-Auth-Signature: " -H "Content-Type: application/json" -H "Accept: application/json" -X GET https://us1.pdfgeneratorapi.com/api/v3/templates
"@

PS> ConvertTo-IRM $CurlString

Invoke-RestMethod -Uri 'https://us1.pdfgeneratorapi.com/api/v3/templates' -Method GET -Headers ('{"Content-Type":"application/json","X-Auth-Key":"61e5f04ca1794253ed17e6bb986c1702","Accept":"application/json","X-Auth-Workspace":"[email protected]","X-Auth-Signature":""}' | ConvertFrom-Json)

Or

PS> ConvertTo-IRM -CurlString 'curl --request GET "https://ncg1in-8d1rag:[email protected]/tickets?status=open,onhold&role=user&limit=6&format=json"  --data ""'

Invoke-RestMethod -Uri 'https://api.sherpadesk.com/tickets?status=open,onhold&role=user&limit=6&format=json' -Method GET -Body '""' -Headers ('{"Authorization":"Basic bmNnMWluLThkMXJhZzo1bnVhdXpqNXBrZmZ0bHozZm15a3NteWhhdDZqMzVrZg=="}' | ConvertFrom-Json)

curl2ps's People

Contributors

stephanevg avatar theposhwolf avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.