Can I use variables in my DNS API Calls?

For Workers & Pages, what is the name of the domain?

belcherinc.com

What is the error number?

9207

What is the error message?

code":9207,“message”:"Request body is invalid.

What is the issue or error you’re encountering

Just trying to figure out the syntax to use variable in a PUT or PATCH

What steps have you taken to resolve the issue?

Tried:
“content”: “$currentIp”
“content”: “currentIp”
“content”: “'”$currentIp"'"
“content”: $currentIp

All throw 9207’s Body is invalid.

Can you describe what you’re doing in a bit more detail? Are you trying to change a DNS record via the API?

I thought I tried this, guess not. It works.

         -d '{
           "comment": "Domain verification record",
           "content": "'"$currentIp"'",
           "name": "voip.mydomain.com",
           "proxied": false,
           "ttl": 60,
           "type": "A"
         }'

Thanks all!

That’s exactly what I was trying to do. But I got it working!

1 Like