I created an API to connect to my Cloudflare zone. I tested the API token and it works. Now when I try to add multiple domains with the API command that CLOUDFLARE provides it does not work. Keep getting an error message. Any see what is going on here. Here is the API command that Cloudflare provides that is not working I keep getting this error message.
{“success”:false,“errors”:[{“code”:6003,“message”:“Invalid request headers”,“error_chain”:[{“code”:6103,“message”:“Invalid format for X-Auth-Key header”}]}],“messages”:[],“result”:null}
for domain in $(cat domains.txt); do
printf “Adding ${domain}:\n”
@Cyb3r-Jak3 I was able to add 1 domain in my domain.txt file. Whenever I add more than 1 domain in the list it only adds the one at the bottom of the list. The rest gives me this error message.
[{“code”:6007,“message”:“Malformed JSON in request body”}],“messages”:[],“result”:null}
I’m also using GitBash in windows to run the API in the first post.
Can you add set -xe at the top of your bash script and run it? It should show the curl command being run, which will help view the JSON body being sent.
Ok I added set -xe. Same thing. I can only add one domain at a time. Even if I put 2 domains in the domains.txt file the first one comes out with the MALFORMED JSON and the 2nd one gets added with no problems.