The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

API addon domain issue - "I do not believe you control the subdomain"

Discussion in 'cPanel Developers' started by rlesterphx, Sep 8, 2010.

  1. rlesterphx

    rlesterphx Member

    Joined:
    Jul 22, 2010
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Part of my web app takes a URL from the user, checks to make sure that its nameservers are pointed at our server, and if so adds it (via PHP and the XML API) to our server as an addondomain. This is all set up and working properly, though I keep running into issues and I can't figure out if I'm having them because I'm testing with the same domain over and over (add it through my web app, then log into cPanel UI and manually delete it, repeat) or what is happening.

    The issue I'm currently having:
    1. I go into cPanel, remove the addon domain I'm testing with so I'm starting "fresh" (I'm sure there are traces related to the domain still in files on the server, but don't think it should matter because it's the same setup every time).
    2. Then I go to my web app, use the function to add my domain as an addon domain and it works fine. I can verify by going back to the cPanel UI and now I can find it again in the addon domains section.
    3. Now I go to the part of my web app where users can delete their domain (does some internal DB querying and then uses cPanel API to remove the addondomain). Here's where I run into trouble. When I try to delete the addon domain using the API2 AddonDomain::deladdondomain function, I get this error:
    When the deladdondomain function gets called it's with the same user/pass I used to create it, which is what confuses me. Could someone explain this?

    I did plenty of research before posting here and I see a lot of people suggest editing all sorts of apache config files...I tried that solution, it didn't really help and I almost ended up deleting all of my server's hundreds of addon domains!

    Thanks!
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi rlesterphx,

    I know you said you've done your homework, and I don't mean to question you, but just to be sure that we're on the same page:

    In your API deladdondomain call, the "subdomain" argument you're passing, it is it the "domain_key", right?

    from ApiAddonDomain < ApiDocs/Api2 < TWiki
    I bring this up not because it's a common mistake, but because I know there was incorrect documentation for this particular call, which got fixed about a month ago. The current documentation (which I've linked above) is correct.

    Just let me know and we'll try and get this figured out.

    Regards,
    -DavidN
     
  3. rlesterphx

    rlesterphx Member

    Joined:
    Jul 22, 2010
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Solved

    Thank you so much, DavidN. That was it.
    I guess I missed that part in the doc explaining the domainkey thing, or maybe I looked it up before that edit was made.
    I was having a similar issue before with the SubDomain::delsubdomain function and after some snooping around and debugging figured out that the "domain" variable needed to be in that "subdomain_maindomain.com" format (you should probably update that doc too and note it).

    Thanks again!
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    No Problem! Glad it was as simple as that. I'm making an internal report to verify the documentation on SubDomain::delsubdomain right now. Thanks for the heads up.

    Regards,
    -DavidN


    UPDATE
    Concerning API2's SubDomain::delsubdomain: I've test the call via XML-API in WHM/cPanel 11.27.77 and it works as expected (per existing documentation). So either the reported issue is a bug or some other arbitrary environment issue that is not know (from the brief discussion here); fonder for another thread or support ticket.

    Permutations that worked to delete asub.mydomain.net
    Code:
    'asub.mydomain.net'
    'asub'
    'asub.mydomain.net_mydomain.net'
    
    Existing documentation
    If that doesn't work for someone, please open a new thread with an appropriate title (ie, SubDomain::delsubdomain) or open a support ticket.

    Best Regards,
    -DavidN
     
Loading...

Share This Page