Hi, I have been trying for several hours to figure out how to use the Remote API, but there is no proper documentation on the subject available. Can someone provide me with examples on how to: Create a website "x.com" with Proxy Redirecting to "https://y.com" ? Create a subdomain "s.x.com" with Proxy Redirecting to "https://s.y.com" ? Create an e-mail domain "mail.com" AND an e-mail account "[email protected]" with password "xyz" with SMTP+POP3 enabled but IMAP disabled? I'm currently working on a project where we have been planning on using ISPConfig's Remote API for a long time. But the lack of documentation makes me really worried that we have to find another solution, which basically puts us back 3 months :-S A command line interface is also an option if it is reliable and documented - anything that can help us automate things. I'd really love to avoid SOAP though if possible. * Fingers crossed * - Thanks
The documentation for the remote API is in the remote_client folder of the ISPConfig tar.gz. The examples and documentation that you find there are for the SOAP flavor of the API, but the REST version is identical, just that it get's the data by POST request and returns the data in json format. The remote API is stable and used by most larger ISPConfig installations since many years, it is also used by the ISPConfig WHMCS plugin (see thread in this forum, e.g. in case you like to see more examples in that code) and it is also used by the ISPConfig Migration tool. Here a short example on how to use the REST version: 1) Login to the API to obtain the session id token: Code: curl --header "Content-Type: application/json" \ --insecure --request POST \ --data '{"username":"admin","password":"xxxxxxxxx"}' \ https://localhost:8080/remote/json.php?login 2) Then you can e.g. get the data of a dns zone like this: Code: curl --header "Content-Type: application/json" \ --insecure --request POST \ --data '{"session_id":"8a550bdbee45385dcbed3beadc78167f","primary_id":{"origin":"test.tld."}}' \ https://localhost:8080/remote/json.php?dns_zone_get Adding something is similar, just put all the data columns in the POST data section and set the function name as GET parameter. Here an example of the newly added config store function: Code: curl --header "Content-Type: application/json" \ --insecure --request POST \ --data '{"session_id":"8a550bdbee45385dcbed3beadc78167f","group":"migration","name":"test","value":"1"}' \ https://localhost:8080/remote/json.php?config_value_add In regard to the command line script, there is one and it uses the REST API as well, you can find it in the remote_client/cli/ folder of the master branch. So one more example of software that uses the ISPConfig remote API.
Thanks God! Sorry I jumped to conclusions. We are getting used to great documentation on HowToForge, so it just wasn't aligned with the level of quality and accessibility we are used to. Also, it's really hard to google things in an archive. Perhaps consider making it available from the website. In any case, thank you very much for the snippets to get us started Jimmy
We keep the API docs in GIT so that developers can commit changes to them directly. They are accessible online as well when you have an ISPConfig git account (https://git.ispconfig.org).
This post helped me check that my ISPConfig remote user could connect correctly while troubleshooting the whmcs connection. Thanks again @till! -John
I should have added what I learned today for other API newbies benefit. I am having a problem getting limit template details on a remote whmcs install. After the login command above I plugged my session_id into the client_templates_get_all request below. curl --header 'Content-Type: application/json' --insecure --request POST --data '{"session_id":"LongStringOfLettersAndNumbers"}' https://nginx1.yourpublicurl.com:8080/remote/json.php?client_templates_get_all In my case it worked perfectly and returned all details of my one and only limit template. So I know the problem is not with this specific ISPConfig install or firewall/networking on my end. Simple things I'm sure, but I use curl once or twice in a decade and never before for testing an API.