Using mass_edit_zone API function
-
Hey hey! For #1, I don't have a better tool that parse_zone For #2, we do have these calls: Delete DNS zone record " cPanel & WHM Developer Portal - that requires knowing the line number you want to change Update IP addresses in zone files " cPanel & WHM Developer Portal - that's a more specific operation to change the IP. If you need other features, it would be best to open a feature request to let our developers know, as those do get reviewed by our team. 0 -
Another question about mass_edit_zone: /mass_edit_zone?zone=$host&serial=$serial&add=$json[\code] When I want to add a DNS record like an SPF record, the host name on the final DNS record should be just "example.com". If I specify the following for the add= json:{"dname":"example.com", "ttl":14400, "record_type":"TXT", "data":["v=spf1 a mx ip4:11.22.33.44 ~all">}
The resulting DNS record in cPanel shows up with a host name of "example.com.example.com", as if the API is combining dname and zone to get the final record's host name. If I try to compensate by specifying an empty dname in the json, then the API returns an error "each add requires a dname...". How do I use mass_edit_zone to create an DNS record where the record's host name is simply the domain name (zone)?0 -
I've resolved the last issue with mass_edit_zone. The function allows you to specify a dname parameter of simply "sample" and it will create a DNS record with the name "sample.example.com" (if your domain is example.com). In that case, it appears to do the concatenation for you if the domain is not specified in the dname parameter. However, it won't allow dname to be blank. So if you try to set dname to the domain, "example.com", you get a final record of "example.com.example.com". But apparently, if you specify the dname as the domain name AND a trailing period (.) : "example.com.", then it leaves it alone and creates the record with the specified dname without adding the domain to it again. So it appears the function tries to be intelligent and adds the domain to the dname if the dname doesn't include it, or perhaps if there is no trailing period in dname. If you need *nothing* added to the domain for the record's name (i.e. you want the DNS record name to be simple "example.com", you need to specify "example.com." with the trailing period as your dname parameter. I don't know if developers are expected to always include the entire record name including the domain and trailing period for all add operations, but if that's the case, the function probably shouldn't make assumptions and allow you to do otherwise by adding the domain to the name internally if not specified in dname. I'm posting this solution here for future developers to find, but this would again be very useful information for the documentation page with regard to the "add" function and the "dname" parameter description. 0 -
I would expect the trailing dot to be standard syntax for any DNS zone work. Is that not what you're experiencing? I see a few other typos on that page that I'll submit at the same time, but I just want to make sure I'm understanding what clarification you're looking for. 0
Please sign in to leave a comment.
Comments
4 comments