Documentation for API fetchzone_records?

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
Thanks -- I did see that, but I am currently using several API functions successfully that I know I looked up in the cPanel docs some time ago in order to get their usage.

Here are some URLs that currently work but I can't seem to find in the API docs any more. I'm searching the docs using only the function name (i.e.
fetchzone_records, remove_zone_record, add_zone_record, fetchdiskusagewithextras), but not coming up with anything:

Code:
/json-api/cpanel?user=$user&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=fetchzone_records&cpanel_jsonapi_version=2
/json-api/cpanel?user=$user&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=remove_zone_record&cpanel_jsonapi_version=2
/json-api/cpanel?user=$user&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=add_zone_record&cpanel_jsonapi_version=2
/json-api/cpanel?cpanel_jsonapi_user=$user&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=DiskUsage&cpanel_jsonapi_func=fetchdiskusagewithextras
Thanks!
 

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
I saw that article as well when I googled. I have many functions in use from API version 2. Some said (at the time I saw the docs on them) something like "we recommend using the UAPI, but no UAPI function exists for this...". Do the *new* alternatives to these functions return the same data structures or do I need to now rewrite all of the code that calls these functions to use their newer alternatives?

Oddly, when I view the "dumpzone" API, the URL version lists it as "version 1" whereas the functions I'm using are listed as version 2 (at least they were in the original docs when I got those URLs:
Code:
https://hostname.example.com:2087/cpsess##########/json-api/dumpzone?api.version=1&domain=example.com
The doc page for dumpzone also says this on it: "This function is deprecated. Use WHM's parse_dns_zone function." However, even parse_dns_zone shows as version 1 API:
Code:
https://hostname.example.com:2087/cpsess##########/json-api/parse_dns_zone?api.version=1&zone=example.com
This seems confusing that the api.version=1 URL is in the documentation and is the current function, whereas the cpanel_jsonapi_version=2 URL is considered older?
 
Last edited:

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
Hi, Any update on this question? It's been a couple of weeks since I originally asked and I really need to access documentation for these API functions that are still active in the cPanel API but seemingly have no docs... Thanks!
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,399
2,255
363
cPanel Access Level
Root Administrator
@swbrains - it looks like Anthony wasn't able to get much information on this one.

I see the docs for the functions you mentioned here:



Is that what you were looking for?
 

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
I have seen these functions in the API docs. So dumpzone is deprecated, but what about fetchzone_records mentioned earlier (which is what I'm using now) -- it's not even listed in the docs, yet it still works.

Also, when looking at parse_dns_zone (and others that I assume are the "new/current" functions), I see it returns metadata saying Version=1. This is confusing as I thought version 1 of the API was deprecated.

Finally, is there a cross reference that will tell developers which new functions to use in place of deprecated ones. I see that dumpzone's docs refer to parse_dns_zone, but what about the others I listed above? They don't even exist in the docs to tell me what I should be replacing them with:

fetchzone_records
remove_zone_record
add_zone_record
fetchdiskusagewithextras
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,399
2,255
363
cPanel Access Level
Root Administrator
fetchzone_records is older, so it would have to get pulled from the older documentation here:


Does that get you the details you're looking for?

As far as the "version 1" output, all the "whmapi1" calls include that, so that seems normal to me. As an example, here's the create account API, which definitely isn't out of date, and shows the same thing:

 

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
Thanks -- the link to the old docs certainly helps. Unfortunately, the message on that page indicates that no UAPI function exists to replace it (which is true), but doesn't mention something like parse_zone (or parse_dns_zone), which, while not an exact replacement, seems to be the closest function when looking to replace the original fetchzone_records

The version numbers are confusing. I thought I had read that version 1 API functions were deprecated, but it seems there's a distinction between *WHM* API functions and *cPanel* functions and their versioning, and which ones are deprecated at version 1.

On a related side note, I wish the developers would have considered using an identifying prefix on the WHM vs cPanel API functions: something like "whm_function_name" vs "cpanel_function_name". It would make it much clearer when searching the docs for "dns zone" and you get two results in the list that are both titled "Return a Parsed DNS Zone", but each leads to a function in a different API. After clicking the result link, one needs to scroll through the vertical function reference panel on the left to determine which API the current function belongs to: WHM or cPanel. At a bare minimum, if the docs for both APIs are going to be combined as they are, adding a line to the top of each function's details page that indicates clearly which API it belongs to would be helpful. Better yet, add it to the titles that appear in the search results... Or, separate the API docs... Or, require a choice as part of the search to filter which API results will be shown for (WHM, cPanel, or Both). Most times I only want results from one of these.
 

swbrains

Well-Known Member
Sep 13, 2006
304
44
178
Thanks for checking on this.

So cPanel API version 1 = bad. WHM API version 1 = good. Got it.