For Workers & Pages, what is the name of the domain?
What is the error number?
9101
What is the error message?
[{Code:9101 Message:weight is a required data field. ErrorChain:} {Code:9101 Message:port is a required data field. ErrorChain:} {Code:9101 Message:target is a required data field. ErrorChain:}]
What is the issue or error you’re encountering
I’m trying to use the API to create SRV records with the content
field, rather than individual data components. The docs and the API seem to be in disagreement.
What steps have you taken to resolve the issue?
I have tried referring to the documentation, which suggests I should be able to do this: Cloudflare API | DNS › Records › SRVRecord
content
: string Optional
Priority, weight, port, and SRV target. See ‘data’ for setting the individual component values.
And all the fields for ‘data’ say optional as well. (See screenshot)
What are the steps to reproduce the issue?
This command, with API token and domain replaced:
$ curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records" \n
--header "Authorization: Bearer $API_TOKEN"
--header "Content-Type: application/json"
--data '{"type": "SRV", "name": "_service._tcp.example.com", "content": "1 5 25565 example.com", "ttl": 120}'
gives the above error, indicating that individual components are required, but for simplicity in my code I just want to use the content string. It is already formatted like Cloudflare expects for SRV records.
It seems like the documentation is wrong, or the API is erroneously requiring the optional fields. But something isn’t right either way.