While trying to search for specific URI record using API (postman and cloudflare-python) with “content” attribute, is not able to find the register unless use double quote literal. Ex: 13 56 “api.example.com” . If remove the double quote from the API would not be able to find the register. This issue is not present with SRV register; API is able to find it by the content without using double quote. Will like to know why this difference.
What steps have you taken to resolve the issue?
Search URI register by content (priority weight “target”):
“content”: 13 56 “api.example.com”
Search SRV register by content (priority weight port target):
10 5 443 api.example.com
Hi @_Cubano! Thank you for the excellent question!
This behavior is related to how these records are represented in zone files. URI records contain a URI as a quoted string (see, e.g., the example on URI record - Wikipedia), while an SRV record target is a simple domain name, which does not need to be represented as a “character-string” (as the RFCs call it).
(By the way, you’d probably want a valid URI like https://api.example.com instead of the plain domain name api.example.com as your URI record target.)
Confusingly, for historical reasons, we currently don’t include the quotes in the “content” field that’s sent by the API, which explains the inconsistency you’re seeing. I’ve created a ticket for that and we’re hoping to get it fixed in the not-too-distant future. We’ve also been planning to include record priorities in the content as well, which as surely have noticed is another little inconsistency. That one may take some time to fix since it’s a user-visible change that also affects MX records, one of the most widely used record types, but we’re working on it.
Hope that makes sense. Thanks for pointing out this inconsistency!
Hi @janik1 Thank you for your detailed feedback. Really appreciated.
Indeed, will be good “include record priorities in the content as well” since the API search capabilities does not match with the “content” response; must construct the “content” value for SRV and URI.
Base on the Testing performed comes out that ID of any DNS record is not required but in the official documentation it is, even passing the ID will not consider and the system will return different ID.
Regarding the ID, are you referring to it being included in the request body on Cloudflare API Documentation? If so, you’re absolutely right, I’ll see if we can get that fixed too