Endpoint
Use the following HTTP request method and path to access the API:
POST /api/convert
Request Format
The request body should be in JSON format, containing a curl
field with the curl command string to be parsed:
{
"curl": "your curl command here"
}
Response Format
The response content is a structured JSON object containing the following fields:
- method: HTTP request method
- url: Request URL
- headers: Request headers
- data: Request data
{
"method": "POST",
"url": "https://curl-to.com",
"headers": {
"Content-Type": "application/json"
},
"data": {
"key": "value"
}
}
Example Code
Here are examples of calling this tool's API in different programming languages:
fetch('/api/convert', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
curl: 'curl -X POST https://curl-to.com -H "Content-Type: application/json" -d \'{"key":"value"}\''
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests
import json
url = "http://curl-to.com/api/convert"
payload = {
"curl": 'curl -X POST https://curl-to.com -H "Content-Type: application/json" -d \'{"key":"value"}\''
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())
curl -X POST http://curl-to.com/api/convert \
-H "Content-Type: application/json" \
-d '{"curl": "curl -X POST https://curl-to.com -H \"Content-Type: application/json\" -d \"{\\\"key\\\":\\\"value\\\"}\""}'