url
body
method
body
headers
body
body
body
curl -X POST https://tcpdata.com/generate-curl \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.example.com/users",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
},
"body": {
"name": "John Doe",
"email": "john@example.com"
}
}'
# Returns a formatted curl command:
# curl -X POST \
# -H "Content-Type: application/json" \
# -H "Authorization: Bearer token123" \
# -d '{"name":"John Doe","email":"john@example.com"}' \
# "https://api.example.com/users"
const response = await fetch('https://tcpdata.com/generate-curl', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: 'https://api.example.com/users',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer token123'
},
body: {
name: 'John Doe',
email: 'john@example.com'
}
})
});
const result = await response.json();
console.log(result.curl);
import requests
response = requests.post('https://tcpdata.com/generate-curl', json={
'url': 'https://api.example.com/users',
'method': 'POST',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer token123'
},
'body': {
'name': 'John Doe',
'email': 'john@example.com'
}
})
print(response.json()['curl'])