Paste a curl command and get the same request in JavaScript, Python, PHP or Go, or as a Delay API call that sends it later or on a schedule.
What curl sends
POST https://api.example.com/v1/reports
Headers
Body JSON
{"report": "daily", "notify": true}
Code
The code shows up here when JavaScript is on.
Runs in your browser. Nothing you type here is sent to a server.
Delay sends HTTP requests on a cron schedule or after a delay, retries failed jobs on your queue's delays, and can alert you when a cron keeps failing. Pick Delay above to get the API call. Free for 1,000 requests a month.
curl has defaults that HTTP libraries don't share, and the code keeps them so it sends the same request and treats the answer the same way. curl doesn't follow redirects unless you pass -L, so the code turns redirects off (redirect: 'manual', allow_redirects=False, 'allow_redirects' => false, CheckRedirect in Go). curl doesn't treat a 404 or a 500 as an error, so the PHP code sets 'http_errors' => false instead of letting Guzzle throw.
The body follows curl's rules too. -d sends a POST with Content-Type: application/x-www-form-urlencoded, several -d values are joined with &, --json sets both the JSON content type and Accept, -G moves the data into the query string, and -u becomes Basic auth.
In Chrome, Edge, Firefox or Safari, open the developer tools, go to the Network tab, right-click a request and choose Copy, then Copy as cURL. On Windows, pick the bash version: the cmd version escapes characters with ^, which this page doesn't read.
A copied request carries your cookies and session tokens. Delete the headers you don't need before you put the code in a repository, and treat the rest like a password.
Pick Delay above to get the API call that makes Delay send this request for you: once, up to 24 hours from now, as a job, or on a cron schedule. A job that fails is retried on its queue's delays and ends up in the dead letter queue if every attempt fails. A cron runs on its schedule, in its time zone, and can alert you when runs keep failing.
A few things change on the way. Delay sends the payload as JSON, so form fields arrive as a JSON object. It sends GET, POST, PUT, PATCH and DELETE, doesn't follow redirects, and can't upload files. Each case is spelled out under the code.
No. The command is read and converted in your browser, and the request is never sent. Tokens and cookies in the headers stay on your machine. Still, swap real secrets for test ones before you share the code.
Because -d without a Content-Type header sends application/x-www-form-urlencoded, whatever the body looks like. Add -H "Content-Type: application/json", or use --json, which sets the content type and the Accept header. The converter warns when it sees JSON sent as a form.
-d sends the text as it is, but reads a file when the value starts with @ and strips its line breaks. --data-raw never reads files. --data-binary reads files byte for byte. --data-urlencode percent-encodes the value first, so spaces and & are safe.
curl doesn't follow redirects unless you pass -L, and fetch, requests, Guzzle and Go do by default. Turning them off keeps the behaviour the same. Add -L to the command and the code follows them.
The ones that shape the request: -X, -H, -d and its variants, --json, -F, -G, --url-query, -u, --oauth2-bearer, -A, -e, -b, -I, -T, -L, -k, -m and --connect-timeout. Output options like -s, -v, -o and -w are skipped, and options that can't carry over, such as proxies, are listed under the code.
Yes. Pick Delay, then On a schedule, and set a cron expression and time zone. Delay calls the URL on that schedule, keeps every response, and alerts you after the number of failed runs you choose.