curl2http Converter

Convert cURL commands to REST CLI request files.

Basic Usage

restcli curl2http 'curl https://api.example.com/users'

From clipboard:

pbpaste | restcli curl2http

Flags

Output File

restcli curl2http -o request.http

Short: -o

Import Headers

restcli curl2http --import-headers

Converts cURL headers to profile headers format.

Output Format

restcli curl2http -f json

Options: http, yaml, json, jsonc

Default: http

Short: -f

Examples

Simple GET

Copy this cURL command:

curl https://api.example.com/users

Convert from clipboard:

pbpaste | restcli curl2http -o get-users.http

Result:

### Request
GET https://api.example.com/users

With Headers

Copy:

curl -H "Authorization: Bearer token123" -H "Accept: application/json" https://api.example.com/users

Convert:

pbpaste | restcli curl2http -o get-users.http

Result:

### Request
GET https://api.example.com/users
Authorization: Bearer token123
Accept: application/json

POST with Body

Copy:

curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"John","email":"[email protected]"}'

Convert:

pbpaste | restcli curl2http -o create-user.http

Result:

### Request
POST https://api.example.com/users
Content-Type: application/json

{
  "name": "John",
  "email": "[email protected]"
}

YAML Output

pbpaste | restcli curl2http -f yaml -o get-users.yaml

Result:

name: Request
method: GET
url: "https://api.example.com/users"

JSON Output

pbpaste | restcli curl2http -f json -o create-user.json

Result:

{
  "name": "Request",
  "method": "POST",
  "url": "https://api.example.com/users",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": "{\"name\":\"John\"}"
}

Import Headers

pbpaste | restcli curl2http --import-headers

Extracts headers to profile format:

{
  "headers": {
    "Authorization": "Bearer token123",
    "X-API-Key": "key456"
  }
}

Workflow

From Browser DevTools

  1. Open browser DevTools
  2. Go to Network tab
  3. Right-click request
  4. Select “Copy as cURL”
  5. Paste and convert:
pbpaste | restcli curl2http -o request.http

From Documentation

Copy cURL example from API docs:

pbpaste | restcli curl2http -f yaml -o api-call.yaml

Supported cURL Flags

Flag Support Description
-X Yes HTTP method
-H Yes Headers
-d Yes Request body
--data Yes Request body
-u Partial Converted to Authorization header
--user Partial Converted to Authorization header

Limitations

  1. Complex cURL scripts may not convert perfectly
  2. Shell variables in cURL not converted to REST CLI variables
  3. Some advanced cURL features unsupported

For complex cases, manually edit converted files.