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 - get reseller limits

Discussion in 'cPanel Developers' started by stephen_ahq, Aug 19, 2009.

  1. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I was wondering if there is a way to retrieve the limits for a reseller account via the API?
    I want to get the Disk Space Limit, Bandwidth Limit and Accounts/Domains Limit.

    I found this command: http://server:2086/xml-api/resellerstats?reseller=username but it returns the allocated values rather than the actual limits.

    I've searched the API documentation and these forums, but I can't find any reference to what I am after...

    Does anyone have any ideas, or can point me in the right direction?


    Some context to my problem: I am building an audit system to check the defined limits on the server match the limits in our billing system, but without an API call to retrieve the limits, it cannot be audited...
     
  2. d_t

    d_t Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    243
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Bucharest
    if "actual limits" means current usage, you can list all accouns that belong to a reseller then sum each account usage.
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I'm not understanding what is being said. I am trying to understand how does a "actual limit" differ from an "allocated value?"
     
  4. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    When you set up a reseller account, you assign (among other settings) these three limits:

    - Max Domains
    - Max Disk Space
    - Max Bandwidth

    The reseller can then allocate parts of these limits to their customers. The maximum amount they can allocate is defined by the limits set.

    I don't care about how much is used, or how much is allocated. I want to know how much they have in total to be allocated.

    There is no point getting the current usage and the current allocated amounts as they will not reflect the package they are being billed for.
    I.e. we don't bill them for the amount they allocate, we bill them for their total allowed limits.

    If that doesn't make sense, do this:
    - In WHM go to "Reseller Center"
    -Select a Reseller under "Reseller Modifications"
    - Click "Edit Privileges/Nameservers"

    In the grey box at the top you have this line:
    "Limit the total number of accounts user can create to X accounts"
    That is your Max Domains Limit - I want to get this via API

    Below that under "Resource Usage Limits" you have a table with Disk Space and Bandwidth, I want to get the values in the "Max Allowed" column via API.

    How can I do this??
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    To clarify, it seems you are looking for remaining resources available to be allocated by that reseller. You can do this by performing some mathematical operations on the results of the resellerstats XML API function.

    To receive the remaining disk space available, do totaldiskalloc - diskused (the tag in <result> not <accts>). For remaining bandwidth, do totalbwalloc - totalbwused.

    The remaining number of accounts that can be allocated using a specific package is also determined mathematically. You can use the listpkgs XML API function to list available packages. If you call this function while logged into the XML API as the reseller, you will only see packages that reseller can use.

    You can then take the floor of (reseller's remaining bandwidth / bandwidth that package allocates) and the floor of (reseller's remaining disk space / disk quota the package issues) and whichever number is LOWER is the number of accounts that can be created based on disk space and bandwidth quotas.

    Regarding number of remaining accounts, you can count the number of <accts>...</accts> tags returned by resellerstats to determine the number of accounts that reseller has created. Note, reseller center lets you limit the number of accounts, not number of domains.
     
  6. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Um.... That does not help in the slightest.

    Most of our resellers have not allocated all of their limits, and no amount of maths will ever tell me the full limit from their usage and allocation. (We also don't allow overselling, so the allocation is as good as usage!)

    I'll take it from this that it isn't possible via the cPanel API at this stage - or no-one here understands what I am after.

    Is there a method I can submit a feature request for the API to include something that will be useful for what I am trying to do?
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    That seems to be the case in this thread. If you can provide a sample situation with sample numbers and the information you want, that would help us assist you with how the APIs can meet your needs.
     
  8. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I posted this above.. if you follow these instructions it'll show you what I am wanting to retrieve via the API:

    I want this value - i.e. the maximum accounts the reseller can create

    I also want to get the values in the "Max Allowed" column - these are the max disk-space and max bandwidth the reseller can allocate.

    Does that make more sense?
     
  9. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    We do not yet have a method of retrieving that information via the XML API, but let me see what I can do to get that added.

    The Disk Space value in the "Max Allowed" column is returned in the totaldiskalloc tag in the resellerstats XML API function. The Bandwidth value in the "Max Allowed" column is returned in the totalbwalloc tag in the resellerstats XML API function.

    This is not always the case. For these limits to reflect the maximum the reseller can allocate, the reseller must only be able to create accounts that belong to packages and "Overselling Allowed" must not be checked. These limits are not enforced if you permit this reseller to create accounts that do not belong to packages. If "Overselling Allowed" is checked, this indicates how much the reseller and their accounts can consume before the reseller is no longer permitted to create new accounts.
     
  10. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thanks :)

    Not is isn't.
    I thought this was the case, but in one example I received:
    Max allowed disk space: 3000
    Max allowed bandwideth: 15000
    totaldiskalloc -> 2330
    totalbwalloc -> 14000

    After a bit of confusion, I realised that the totaldiskalloc & totalbwalloc values are the total currently allocated among the resellers created accounts. Not the total allowed for the reseller.

    Hence my problem...

    We don't allow Overselling, so they are the totals to be allocated in our case.

    Although, for the purposes of my script it doesn't really matter anyway - the package we bill the customer is based on the number of accounts they can create, their maximum bandwidth and maximum disk space (it doesn't matter if that is 'allocatable' or 'usable', it is still a hard limit imposed on their account).
    I.e. We specify the three values in the boxes on that page...

    In order to successfully audit each of our resellers, I need to automatically verify that each of these three limits match in the billing system and on the server.
     
  11. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Following up on this thread, I now understand what you mean - sorry about all the confusion.

    I have brought this to the attention of our quality assurance team as there is a disconnect between actual functionality (which I was able to confirm your statement about what this returns) and our documentation.
     
  12. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thanks :)

    I guess I should just wait for an update or something?
     
  13. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    We are modifying the resellerstats function to have 2 additional tags which return how much bandwidth and disk space that reseller can allocate (respectively bandwidthlimit and diskquota inside <result>..</result>, which will return 0 if these limits are not enabled).

    This modification is currently in quality assurance testing. I have no ETA on when this modification will propagate through to the production-worthy builds, but I'll let you know via this thread when it becomes available. Internal Case 32939.
     
  14. stephen_ahq

    stephen_ahq Member
    PartnerNOC

    Joined:
    Aug 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Great, thanks heaps :)
     
  15. acenetryan

    acenetryan Well-Known Member
    PartnerNOC

    Joined:
    Aug 21, 2005
    Messages:
    197
    Likes Received:
    1
    Trophy Points:
    18
    I know it's only been a couple months since this was posted, but I, too, would like use of the functionality stephen_ahq was looking for.

    Any further details on when this API call will be available?
     
  16. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This should be available in the next CURRENT build.

    When? soon. (I wish I could give you more detail than that)
     
Loading...

Share This Page