Managing Sites Using REST API

Discussion in 'Installation/Configuration' started by GR9, Apr 17, 2026 at 6:58 AM.

  1. GR9

    GR9 New Member

    Hello,

    I am having some problems trying to setup sites using the api. I was able to successfully call 'login' and 'client_add', but am having problems with 'sites_web_domain_add' and 'sites_web_domain_get'.

    Calling the ISPConfig RESTAPI using https domain[DOT]tld/remote/json.php?<function_name>
    Using API docs from the installer (ISPConfig-3.3.1p1/ispconfig3_install/remoting_client/API-docs/).
    /usr/local/ispconfig/interface/lib/config.inc.php contains define('ISPC_APP_VERSION', '3.3.1p1');


    Calling 'sites_web_domain_add' with the JSON below results in an error, also pasted below. (Spaces added in domain names due to form restrictions):
    Code:
    {
        "session_id": "{{SESSION_KEY}}",
        "client_id": 3,
        "params": {
            "server_id":1,
            "domain":"domain11 com",
            "cgi":"n",
            "ssi":"n",
            "suexec":"y",
            "errordocs":1,
            "is_subdomainwww":0,
            "subdomain":"none",
            "php":"y",
            "ruby":"n",
            "ssl":"y",
            "ssl_domain":"domain11 com",
            "stats_type":"none",
            "allow_override":"All",
            "active":"y",
            "http_port":80,
            "https_port":443,
    
            "traffic_quota":-1,
            "hd_quota":-1,
    
    
            "backup_interval":"none",
            "backup_copies":0,
    
            "type": "vhost",
            "parent_domain_id": 0
    
    
    
        }
    }
    
    Code:
    {
        "code": "remote_fault",
        "message": "pm_process_idle_timeout_error_regex<br />\r\npm_max_requests_error_regex<br />\r\n",
        "response": false
    }
    pm_* params are not specified in the /API-docs/sites_web_domain_add.html file, but I found an old example on GitHub that had them (github [DOT] com/drez/ispconfig-rest-api-example/blob/master/src/RemoteApi.php#L193). Adding in
    Code:
    "pm_process_idle_timeout" : 10,
            "pm_max_requests" : 500
    returns
    Code:
    {
        "code": "ok",
        "message": "",
        "response": "15"
    }
    This shows up in the UI, however a few things are not set correctly. PHP is disabled, but it should be "PHP-FPM". The docs only have one php param which is ENUM('y','n'), so I'm not quite sure why setting it to 'y' disables PHP. Statistics is also set to AWStats, but it should be None. Since the docs don't specify how to turn this off, I referred to the GitHub example linked previously which specified "none" (Making it capital "None" also does not work).

    I feel like I am missing something here but not sure what it is...

    I am also getting a problem when trying to run sites_web_domain_get
    Providing:
    Code:
    {
        "session_id": "{{SESSION_KEY}}",
        "primary_key":1
    }
    (Or really any number at all, including 0, -1, and positive integers much larger then the number of sites I have created) all result in the same message with an HTTP200 status code:
    Code:
    {
        "code": "ok",
        "message": "",
        "response": []
    }
    I also tried
    Code:
    {
        "session_id": "{{SESSION_KEY}}",
        "primary_key":{
            "domain":"domain3 com"
        }
    }
    (Which at this point had been created over an hour ago so read-after-write should not be a problem), but that returns the same response as providing a number.


    System > System > Server Config > Loglevel is set to "Debug", however nothing relevant gets added to either Monitoring > ISPConfig Log nor Monitoring > Logfiles > System-Log.

    Any help figuring this out is appreciated! Please let me know if you need more information on anything.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Create a website in ISPConfig, check out what's set in the web_domain table for the site you created, and adjust your function parameters to match that.
     
  3. GR9

    GR9 New Member

    Thank you, that resolved the creation issues.
    The call to sites_web_domain_get is still returning the same empty success response however. Is there something I can do to address this?

    Somewhat unrelated, but if a client has a "Master template" set under "Limits" which allocates 50MB of space to the user, and the site is created with hd_quota set to -1, is the size restriction still 50MB?

    Thank you!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    No, the GUI prevents a client from entering values that are beyond his overall quota. If you create a site by API, then you must ensure to set a correct limit.
     
  5. GR9

    GR9 New Member

    Hello,

    Thanks for getting back to me. I am trying to setup a system where the user is provided 50GB of space and can host multiple domains within that space. If I add a domain with `-1` quota, my understanding based on your prior reply is that doing so will override the restriction set at the reseller or client level and allow unlimited storage/traffic. However, specifying a storage/traffic amount subtracts that amount from the quota and does not allow it to be used on another site.

    Is it possible to give a client/reseller account 50GB of storage, then allow them to create any number of websites with the only restriction being that they cannot exceed 50GB collectively? I don't want to user to have to manually set the limits per-site (Like "20GB to site.com and 30GB to domain.com").

    I found this post from 7 years ago which is similar (https://forum.howtoforge.com/threads/quota-based-limits.81365), where the OP seems to be describing a similar system to what I am looking for.

    Is this something that is possible?
    Thank you!
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The quota is set on the user level, and each website has its own user, so if you want to have a website quota, you must set it. Or you build your own quota system based on group quotas.
     

Share This Page