Get/set CUSTOM tokens with CMD_API_CUSTOM_HTTPD

kristian

Verified User
Joined
Nov 4, 2005
Messages
440
Location
Norway
As part of a user migration script, I need to be able to add some custom httpd config into the CUSTOM tokens, more specifically CUSTOM2. I can't seem to find any documentation on how this could be done.

I ran directadmin in debug mode while updating a CUSTOM2 value, and I found out I can POST my new config with (at least) the following, and it'll be saved as expected:
'domain' => 'mydomain.com'
'custom2' => 'my custom2 config here'

However I can't find any similar GET request to the API for fetching any existing values for these tokens. I need to fetch whatever is currently stored in these tokens, so I don't accidentally overwrite it with my own (temporary) config.

Any help appreciated!
 
I still haven't found any way to get the CUSTOMX tokens from the API, it looks like it's simply not supported. I have however noticed that my POST above does in fact not work. It looks like the main httpd custom config, as defined with config in the array, must always be present. So a working POST to CMD_API_CUSTOM_HTTPD must contain domain, config, and then optionally one or more of the CUSTOMX tokens, for example:

PHP:
array(
    'domain' => $mydomain,
    'config' => '# main custom config',
    'custom2' => '# custom 2 token config',
);

Since config always must be present, in order to not overwrite what's in there already, existing contents must first be fetched from the API, and then re-written. Since CUSTOMX token content can't be fetched, there is no way to write values to them, without overwriting whatever might be there already. In my specific use case this time, overwriting existing content is not a problem. Would be great to have a way to fetch the CUSTOMX tokens though.
 
Back
Top