Json api
Hi there,
I've been developing a tool to create DNS records on cPanel hosting accounts for Office 365. I've been pretty successful getting this to work when logging in via WHM using the addzonerecord command. Problem is, many of the people who use this tool will not have WHM accounts. Therefore, I need it to work with cPanel accounts. This is where my confusion begins.
From what I've worked out so far, the JSON api works with both WHM and cPanel. However, the 'addzonerecord' function seems to be available only in WHM.
For example, if I try the following get request in the browser after succesfully logging in to WHM it works.
/https://myserver.com:2087/cpsess9045407411/json-api/listzones
However, if I try the same thing on a cPanel session, like the example below I get a 404 error.
/https://myserver.com:2083/cpsess9045407411/json-api/listzones
So my question really boils down to this - is it possible to manipulate DNS records via the JSON api on cPanel accounts or is this only available to WHM accounts?
Many thanks
-
Hi there, Thanks for the quick response. I was able to answer my own question a few hours after I wrote this post. However, I ran into another issue which is the zoneedit command's inability to create SRV records. Is there any way of doing this using the API that you know of? Tas 0 -
Please review the following document and let us know if it helps answer your question: cPanel API 2 Functions - ZoneEdit::edit_zone_record - Developer Documentation - cPanel Documentation Thank you. 0 -
[quote="cPanelMichael, post: 1622972">Please review the following document and let us know if it helps answer your question: Zone Record Parameters - SRV Record Thank you.
Hi Michael, Yes that link is useful but I am pretty sure it will only work with WHM accounts unless I'm mistaken? To be clear, I need a way to add SRV records to cPanel accounts without the use of WHM. In other words, I need to interact with an API that works with cPanel accounts, not WHM. Hope that makes sense. Tas0 -
Upon further testing, I verified it's not possible to add SRV records through cPanel. URL tested: http://hostname:2082/cpsess12345678/frontend/x3//json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=ZoneEdit&cpanel_jsonapi_func=add_zone_record&domain=example.com&type=SRV&name=_service._protocol.example.com&priority=0&weight=0&port=1234&target=service.example.com
Result:"You may only add A, CNAME, or TXT records"
You may want to vote and add your feedback to this feature request: Allow Advanced Zone Editor To Add All Records That feature is for the advanced zone editor, but it's the same restriction that you see with the API. Thank you.0
Please sign in to leave a comment.
Comments
5 comments