Use RetoolAPI to copy apps/resources in the same space

Hello! I have a doubt regarding RetoolAPI, that basically summarizes to: Is there a way to copy apps/resources programmatically inside the same space?

My use case is the following: once a new user accesses a given space of our org, I would need to automatically create a folder based on their username and copy a few items (apps and resources) to that folder. This space is meant to serve as a retool tutorial/training for our corporate users, and we want to provide them with a personal folder where they can work, and provision them with a copy of the starter app and a few resources for them to play with.

In my workflow (linked to the Retool Event User created) I have been able to automatically generate a folder through RetoolAPI by obtaining the user data from the /users endpoint. However, I find myself unable to copy things to that folder.

The endpoint /spaces/copyElements seems to be able to to this, but only between different spaces (and it would not allow to copy stuff to that specific folder as far as I can tell). The folders/{folderId} (update folder) endpoint seems like it might also do the trick with the "copy" operation, but all I get is "invalid path".

Is there a way to archieve this? Am I missing something?

Thanks in advance!

1 Like

Hi @AlejandroBF - welcome to the community! :wave:

I did some testing this afternoon, as I'm not super familiar with this part of the product, and there currently isn't a way to implement the flow that you've described here. As you mentioned, it's possible to create a new folder for each user and even to copy over apps/resources/workflows from a "Template" space, but there isn't a solution for that last step - moving them into the newly created folder. :sweat_smile:

It would be trivial with a PATCH /apps/:appId endpoint, too, as the app model has a parent_folder_id attribute. I'll talk to our team about potentially implementing that! At the same time, I'll start a conversation around the ability to copy entities within a space. I'll provide any updates here as soon as I can!

1 Like

Hello Darren, thanks a lot for taking the time to answer and communicate these suggestions :slight_smile: ! We will be monitoring this thread then.

It is not something that will block us, but it'd be nice to have that degree of control in order to keep certain spaces tidy.

1 Like

Agreed! I think there are quite a few potential applications for the features you've described and it's already generated a bit of interest internally. I'll keep in touch!