Skip to main content

parking and unparking domains - API function

Comments

7 comments

  • cPRex Jurassic Moderator
    Hey hey! As a test, I created a parked domain with this command: whmapi1 create_parked_domain_for_user domain='testpark.domain.com' username='username' web_vhost_domain='domain.com'
    After doing that, I didn't have any trouble using the delete_domain call to remove that: [root@host /]# whmapi1 delete_domain domain='testpark.domain.com' --- data: type: parked username: username metadata: command: delete_domain reason: OK result: 1 version: 1
    so maybe it was something with the authentication string in the json formatted call?
    0
  • swbrains
    Thanks for testing that. Were you logged in as root for your test? The only reason I'm doubting the auth strings is that the code has been working for years and I only substituted the URL for the new API call with the proper domain (validated at runtime that the URL and domain specified are proper). The authentication credentials are not part of that URL; I pass them first using Perl: $request->authorization_basic($user, $pass);
    then the API URL is sent via a GET. So the auth process is the same as it was under the old API call which worked which confuses me. I'll keep investigating...
    0
  • swbrains
    I can execute the WHMAPI1 command from a Putty shell as you did and call delete_domain successfully. However, I was logged in as root during this test. I tried logging into SSH using my reseller account, but when I issued the same WHMAPI1 command, it returned a long set of errors, including the usage of the command, as well as "This program can only be run by root!"
    0
  • swbrains
    I have confirmed that if my Perl script uses "root" user and password, the delete_domain succeeds in deleting the specified subdomain. Using the reseller user and password worked in the same script using the old Park::unpark function. Does delete_domain really require root priviliges, and if so, is there some other way to remove a parked domain that doesn't?
    0
  • cPRex Jurassic Moderator
    I was logged in as root for my testing - yes, the delete_domain does require root. If you're okay with another older function, we've got this:
    0
  • swbrains
    Thanks. Yes - I was using that Park::unpark function previously. I'm currently going through all of our code trying to eliminate any functions that don't appear in the latest API docs, since I'm assuming if they aren't listed there that they are either being deprecated or likely to be deprecated in the near future, and I want our code to be on the latest API functions whenever possible to eliminate having to rewrite it later under a tighter timeframe (before the functions go away). :) PS: Another suggestion to the doc group: It would be beneficial if the docs could clarify when any special privileges are required for a function; particularly if it requires root privileges.
    0
  • cPRex Jurassic Moderator
    As far as I know, anything in the cpanelapi section will not require root - only the whmapi tools do. Non-root items would be anything under this branch here:
    0

Please sign in to leave a comment.