Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Json api

Discussion in 'cPanel Developers' started by tasgray, Apr 14, 2014.

  1. tasgray

    tasgray Registered

    Joined:
    Apr 11, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    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
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,521
    Likes Received:
    1,964
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 cPanelMichael, Apr 15, 2014
    Last edited: Dec 3, 2018
  3. tasgray

    tasgray Registered

    Joined:
    Apr 11, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    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
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,521
    Likes Received:
    1,964
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #4 cPanelMichael, Apr 16, 2014
    Last edited: Dec 3, 2018
  5. tasgray

    tasgray Registered

    Joined:
    Apr 11, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    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.

    Tas
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,521
    Likes Received:
    1,964
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Upon further testing, I verified it's not possible to add SRV records through cPanel. URL tested:

    Code:
    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:

    Code:
    "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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice