Paper Lantern for cPanel accounts is being retired this year. Find out more »
cPanel & WHM Version 102 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Copy directories,files and dump sql files between accounts via whm/uapi

Bahadır BIYIK shared this idea 8 months ago
Not Planned

Recently we build a project that is using WHM & UAPI to create accounts and copy script files via skeleton directory which is working perfectly.

What challenged us is, after installing latest version of script we also needed to copy some resource files. These resources and sample SQL files are located in another account in same server, so we need to copy them to new account and dump SQL file.

It might seem kinda personal request but google search shows me that there are people looking for same feature as well.

We made it work by updating our script to pull resources but it would be easier if we can do it via API through reseller tokens.

I know that this can also be done with hooks but as far as i know hooks can not be attached to a reseller. So it runs everytime for any owner account.

Just an idea.

Replies (1)

photo
1

I'd need a bit more to fully understand your problem, but I wonder if it would be solved by calling the cPanel APIs via WHM API with the correct permissioned user. Have a look at https://api.docs.cpanel.net/whm/use-whm-api-to-call-cpanel-api-and-uapi/#introduction and see if it better aids you in solving your problem.

photo
1

Here is a more detailed scenario;


I've a user with Reseller Previleges and token generated with all permissions granted (reseller_user)

I've another user with necessary files under its home folder and subfolder and database backups (source_user)


What i need is when I create a new account with reseller_user through API; (new_user)

1. I want to copy files from "source_user"s "/home/source_user/anydirectory/anysubdirectory" (which may or may not be in public_html) to "new_user"s prefered directory

2. I want to dump SQL file that is located "/backups/source_user/some_sql_backup.sql" to newly created "new_user"s database


All operations must be completed via reseller_user API or over reseller->UAPI functions

photo
1

Thank you for the additional information Bahadır! I'm going to mark this not planned as it is not currently on our roadmap, but your feedback will help us make decisions on this going forward.

photo
Leave a Comment
 
Attach a file