Add multiple domains API not working

Hello,
Here’s CloudFlare’s article: https://support.cloudflare.com/hc/en-us/articles/360000841472-Adding-Multiple-Sites-to-Cloudflare-via-Automation
But when I try their exact copy/paste command this is what happens: 54

So I search for other ways and I found this thread: Adding multiple domains via the API but new error; Image attached in second message because of post limitations.

This time I am able to properly connect to CloudFlare’s API but an “invalid domain” error.
Still my domains are properly written in my txt file.

I even tried to write one domain directly in the terminal, instead of going through the domains.txt file, and I am still getting the “invalid domain” error. Image attached in third message because of post limitations.
But as you can see my domain is valid!

I do not know what to do.
If someone already passed these errors please share your solution.

The domain name likely shouldnt be under singles quotes. Also, “account” should be between double quotes. And I guess $domain wont expand with single quotes.

Try

--data "{\"name\":\"$domain\",\"account\":{\"id\":\"id_of_that_account\"},\"jump_start\":true,\"type\":\"full\"}"

Second image:

Third image: 29

I believe my first response was not entirely accurate. The single quotes should actually work. Though account should still be under double quotes.

Anyhow, before passing that string to cURL, print it first, so you can verify it contains what it is supposed to contain.

I’d expect this to work

--data '{"name": "'$domain'", "account": { "id": "id_of_that_account" }, "jump_start": true, "type": "full"}'

If not, print it and check if the string is actually correct.

Thanks Sandro,
$domain expands correctly yes

I tried your string and but nothing happens: 31

Whats the output when you print it?

What do you mean by print?

Also, it seems there is a “done” missing at the end.

I added the “done”. It establish connection to API but still gets an error: 41

Ehm, you did replace that “id_of_that” with the proper ID, right? Otherwise I wouldnt be surprised and the message actually suggests that.

I just did it and: 53
Nothing happens again. No connection apparently.

I think now you typed a ´ instead of a '.
Well, that is more of a shell issue at this point than a Cloudflare issue.

Again, I’d print the data string to the console instead of calling cURL. That should give you an idea whats wrong. If you still cant figure it out, I’d take it to https://unix.stackexchange.com/

True I wasn’t using the correct ’
Still I tried it now and still getting the error 6007 Malformed JSON…

What do you mean by print the data to the console?

You can use “echo” for that, but that is now way beyond the scope of the forum here. Please take that to https://unix.stackexchange.com/