| title | curl2http Converter | |
|---|---|---|
| description | Convert cURL commands to REST CLI request files. | |
| tags |
|
Convert cURL commands to REST CLI request files.
restcli curl2http 'curl https://api.example.com/users'From clipboard:
pbpaste | restcli curl2httprestcli curl2http -o request.httpShort: -o
restcli curl2http --import-headersConverts cURL headers to profile headers format.
restcli curl2http -f jsonOptions: http, yaml, json, jsonc
Default: http
Short: -f
Copy this cURL command:
curl https://api.example.com/usersConvert from clipboard:
pbpaste | restcli curl2http -o get-users.httpResult:
### Request
GET https://api.example.com/users
Copy:
curl -H "Authorization: Bearer token123" -H "Accept: application/json" https://api.example.com/usersConvert:
pbpaste | restcli curl2http -o get-users.httpResult:
### Request
GET https://api.example.com/users
Authorization: Bearer token123
Accept: application/json
Copy:
curl -X POST https://api.example.com/users -H "Content-Type: application/json" -d '{"name":"John","email":"john@example.com"}'Convert:
pbpaste | restcli curl2http -o create-user.httpResult:
### Request
POST https://api.example.com/users
Content-Type: application/json
{
"name": "John",
"email": "john@example.com"
}
pbpaste | restcli curl2http -f yaml -o get-users.yamlResult:
name: Request
method: GET
url: "https://api.example.com/users"pbpaste | restcli curl2http -f json -o create-user.jsonResult:
{
"name": "Request",
"method": "POST",
"url": "https://api.example.com/users",
"headers": {
"Content-Type": "application/json"
},
"body": "{\"name\":\"John\"}"
}pbpaste | restcli curl2http --import-headersExtracts headers to profile format:
{
"headers": {
"Authorization": "Bearer token123",
"X-API-Key": "key456"
}
}- Open browser DevTools
- Go to Network tab
- Right-click request
- Select "Copy as cURL"
- Paste and convert:
pbpaste | restcli curl2http -o request.httpCopy cURL example from API docs:
pbpaste | restcli curl2http -f yaml -o api-call.yaml| 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 |
- Complex cURL scripts may not convert perfectly
- Shell variables in cURL not converted to REST CLI variables
- Some advanced cURL features unsupported
For complex cases, manually edit converted files.