In curl, just having POST or GET without the -X flag (or --request) has no meaning, and in fact, returns errors:
Running these curl commands with the --verbose flag, we see:
* Could not resolve host: POST
* Could not resolve host: GET
Why do these commands work? Because curl sees the GET/POST as another host, and issues the first request to one of those, then the Cloudflare API in the second request.
These flags aren't required at all, since curl knows that when you send a payload (using the -d flag), you most likely want a POST request. Without a payload, it will, by default, send a GET request.
In my changes, I opted to simply correct the flags, as the API is supposed to respond differently to those methods, so there is instructional value.
Note: I don't use cURL on Windows, and haven't tested there, so did not change those.
In curl, just having
POST
orGET
without the-X
flag (or--request
) has no meaning, and in fact, returns errors:Running these curl commands with the
--verbose
flag, we see:Why do these commands work? Because curl sees the
GET
/POST
as another host, and issues the first request to one of those, then the Cloudflare API in the second request.These flags aren't required at all, since curl knows that when you send a payload (using the
-d
flag), you most likely want aPOST
request. Without a payload, it will, by default, send aGET
request.In my changes, I opted to simply correct the flags, as the API is supposed to respond differently to those methods, so there is instructional value.
Note: I don't use cURL on Windows, and haven't tested there, so did not change those.