How to Create / Edit Package true API

the docs not really helpful about creation or edit exist package.
I found that to create new package we have to use ‘v-add-user-package’.
When i try to send parameters true api like ‘v_package’, ‘v_bandwidth’ and etc…
I’m getting error: Usage: v-add-user-package PKG_DIR PACKAGE

Someone can help here?

Check how it is done in the php code:

You need to create a file with all the Settings

v-make-tmp-file “contents of file” name

The v-add-user-package /tempfilename package name

v-change-user package is about the same

@ eris,
Thanks for the answer.
i tried but seems the file creation process not working.
i tried using:

                'cmd'  => 'v-make-tmp-file',
                'arg1' => $pkg,
                'arg2' => $package_name,

i also tried first to create the file using:

                'cmd'  => 'v-add-fs-file',
                'arg1' => 'admin',
                'arg2' => '/tmp/'.$package_name.'.pkg',

But i don’t see the file is created. And yes, i got message “ok”.
What i am missing here?

See this example for creating a password.

It should work fine. How do you connect?

Also make sure to set returncode to yes.

The example you have provided is the same of what i am doing.
I have changed the “returncode” to yes.
I am using admin user and password to make all the api calls and all working fine beside this.
If I use:

                'returncode'  => 'yes',
                'cmd'  => 'v-add-fs-file',
                'arg1' => 'admin',
                'arg2' => '/tmp/'.$package_name.'.pkg',

The server returns 0 but i don’t see the file in tmp folder.

If I use:

                'cmd'  => 'v-make-tmp-file',
                'returncode'  => 'yes',
                'arg1' => 'some text',
                'arg2' => $package_name,

the return from the server is empty. any idea why?

i also tried to run from ssh and this is what i get:

v-add-user-package /home/admin/tmp/  testdfgdsfds
/usr/local/hestia/func/ line 1533: /usr/local/hestia/conf/hestia.conf: Permission denied
/home/admin/tmp/ does not exists

testdfgdsfds is the file name of testdfgdsfds.pkg that located in tmp folder that i have created from ssh just for testing.

i also tried:

v-add-user-package /admin/tmp/  testdfgdsfds
v-add-user-package /tmp/  testdfgdsfds

same error.

testdfgdsfds.pkg contains this data:


You need to go supply the full name of the file and not the package dir

What do you mean?
If I just provide full name like:
v-add-user-package testdfgdsfds.pkg
i will get error:
Usage: v-add-user-package PKG_DIR PACKAGE

v-add-user-package “/tmp/package.pkg” “test”

Will create test as package name

[email protected]:~$ v-add-user-package /tmp/pack.pkg "testt"
/usr/local/hestia/func/ line 1533: /usr/local/hestia/conf/hestia.conf: Permission denied
/tmp/pack.pkg does not exists

pack.pkg is there.

ok i make some test and upload the pack.pkg to root folder of admin user.
now when i run:
[email protected]:~$ v-add-user-package pack.pkg testt
i get another error related with Permission.

/usr/local/hestia/func/ line 1533: /usr/local/hestia/conf/hestia.conf: Permission denied
grep: /usr/local/hestia/conf/hestia.conf: Permission denied
cp: cannot create regular file '/usr/local/hestia/data/packages/testt.pkg': Permission denied
chmod: cannot access '/usr/local/hestia/data/packages/testt.pkg': No such file or directory
/usr/local/hestia/func/ line 1533: /usr/local/hestia/conf/hestia.conf: Permission denied
touch: cannot touch '/usr/local/hestia/data/users/admin/system.log': Permission denied
grep: /usr/local/hestia/data/users/admin/system.log: Permission denied
/usr/local/hestia/func/ line 145: /usr/local/hestia/data/users/admin/system.log: Permission denied
/usr/local/hestia/func/ line 98: /usr/local/hestia/log/system.log: Permission denied

Now the cli worked but seems that there is some Permission problem that makes this now working in any way…

Any suggestion for this case?

Run with sudo or as root

Yes that’s can fix this but what about to run this true the API?

v-make-tmp-file “contents of package” package

v-add-user-package “/tmp/package” “newpackage”

Would probally work fine

That’s what i did and not worked…
That’s why i also tried true ssh.
The file did not create…

                'cmd'  => 'v-make-tmp-file',
                'returncode'  => 'yes',
                'arg1' => 'test text',
                'arg2' => $package_name,

and when i run
v-add-user-package “/tmp/pack.pkg” “newpackage”
i get error code 3

ok, here is the update.

I have created pack file true the ssh using root user.
Then i run true ssh the cli comand v-add-user-package and all worked fine.
But this not the way this should work.
From what i see and i did so many tests, there is some Permission problem.
i will try to do more tests with some new server provider, but i don’t think that this is some server problem.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.