Solved CMD_API_MANAGE_USER_PACKAGES API is complicated for the new da version

MaXi32

Verified User
Joined
Jul 25, 2016
Messages
658
Location
The Earth
How do you add a user package using API curl on the new DA version 1.62+? This seems to be complicated for the new DA version.

In the old version of directadmin, I got this old parameter (below code) for API that can add user package. This used to work perfectly in the old version of Directadmin but for the new version, this parameter below is not accepted and no package was created but it responded with error=0, meaning it was success but no package was created. This was the parameter obtained from the debug mode for the old version of directadmin:

Code:
data="bandwidth=1000&ubandwidth=yes&quota=100&uquota=yes&inode=&uinode=yes&vdomains=1&uvdomains=yes&nsubdomains=10 \
&unsubdomains=yes&nemails=10&unemails=yes&unemailf=yes&nemailml=0&unemailml=yes&nemailr=10&unemailr=yes \
&mysql=5&umysql=yes&domainptr=0&udomainptr=yes&ftp=1&uftp=yes&php=ON&spam=ON&catchall=ON&ssl=ON&cron=ON \
&sysinfo=ON&login_keys=ON&dnscontrol=ON&suspend_at_limit=ON&language=en&skin=evolution&packagename=${package_name}&add=save"

and this is the new parameter for the new version of directadmin (in a complicated json format):

Code:
Command::doCommand(/CMD_MANAGE_USER_PACKAGES)
ConfigFile::fillFromPost:JSON='{"bandwidth":"1000","ubandwidth":"yes","quota":"100","uquota":"yes","inode":"","uinode":"yes","vdomains":"1","uvdomains":"yes","nsubdomains":"10","unsubdomains":"yes","nemails":"10","unemails":"yes","nemailf":"0","unemailf":"yes","nemailml":"0","unemailml":"yes","nemailr":"10","unemailr":"yes","mysql":"5","umysql":"yes","domainptr":"0","udomainptr":"yes","ftp":"1","uftp":"yes","cgi":"ON","php":"ON","spam":"ON","catchall":"ON","ssl":"ON","cron":"ON","sysinfo":"ON","login_keys":"ON","dnscontrol":"ON","language":"en","skin":"evolution","packagename":"USER_UNLIMITED","json":"yes","add":"yes","feature_sets":"","email_daily_limit":"-1","uemail_daily_limit":"yes","plugins_allow":"[clear]","plugins_deny":"[clear]"}'
CGroup::canCreateUser: start
get_hook_paths_from:/usr/local/directadmin/scripts/custom/package_write_pre.sh: Found hook name 'package_write_pre'
ConfigFile::writeFile:./data/users/admin/packages/USER_UNLIMITED.pkg
get_hook_paths_from:/usr/local/directadmin/scripts/custom/package_write_post.sh: Found hook name 'package_write_post'
ConfigFile::fillFromPost:JSON='{"bandwidth":"1000","ubandwidth":"yes","quota":"100","uquota":"yes","inode":"","uinode":"yes","vdomains":"1","uvdomains":"yes","nsubdomains":"10","unsubdomains":"yes","nemails":"10","unemails":"yes","nemailf":"0","unemailf":"yes","nemailml":"0","unemailml":"yes","nemailr":"10","unemailr":"yes","mysql":"5","umysql":"yes","domainptr":"0","udomainptr":"yes","ftp":"1","uftp":"yes","cgi":"ON","php":"ON","spam":"ON","catchall":"ON","ssl":"ON","cron":"ON","sysinfo":"ON","login_keys":"ON","dnscontrol":"ON","language":"en","skin":"evolution","packagename":"USER_UNLIMITED","json":"yes","add":"yes","feature_sets":"","email_daily_limit":"-1","uemail_daily_limit":"yes","plugins_allow":"[clear]","plugins_deny":"[clear]"}'
Dynamic(api=0, error=0):

Now I don't understand how do I pass this new parameter to be used with curl ? I don't think curl accept this json parameter. This API CMD_API_MANAGE_USER_PACKAGES is not documented officially in the API list. The only place that exist is this old release document that is outdated https://www.directadmin.com/features.php?id=583

Appreciate your help on this. Thanks

(I think this should be moved into Technical Question. If moderator can do this please help me move this thread)
 
Last edited:
Guys I think I found the problem, this was due to the authentication level. The record was created successfully but it was for reseller not admin (So both reseller and admin can have the same package name under reseller). Was confused with the new UI display. That means, I still can use the old parameter without issue. My mistake. Sorry and thanks.
 
Last edited:
Back
Top