Get workflows Issue

I am using the latest version of N8n .
I did self hosting (via Cloudron)

Trying to use this template Backup n8n workflows to Google Drive | n8n workflow template

On the ‘Get Workflow List’ Node ‘URL’ field , I am entering my n8n directory URL by replacing the template’s URL (I am entering: https://hook.mydomain.com/rest/workflows) which is my n8n installation URL and where I login.
On the basic auth credentials , I set up my admin login which I use to login on my self hosted n8n. But still it shows ‘Unauthorized’
What am I doing wrong?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@nahidz3 , that post state “Temporary solution using the undocumented REST API”. However, the n8n API is well documented. I would advise to follow the documentation and make the adjustments to that workflow (if you still want to use it).

In particular, note that

  • authentication is done via API key
  • the API URL to get the list of the workflows is /api/v1/workflows
2 Likes

Yeah That Solved my issue
Though it broke some of my other steps from that template. I am newbie with this, so kinda hard for me to fix all the steps!

@nahidz3 , if you still struggle, that workflow can actually be minimized to this one.

Thanks a Lot ihotom, for making things easier for a person like me. You could share it as a template as it will help many users like me.
One thing I would like to ask, is that possible to add a feature for versioning? For now, it just adds many json files (1 for each workflows) inside a folder. so when it takes backup next time, those will be again uploaded to the same folder with same names which can be a little mess.

@nahidz3 ,

is that possible to add a feature for versioning?

Google Drive is not a version control system. I cannot see such a functionality in the Google Drive node. What could be done, however, is the older version deleted and new uploaded. Does that work for you?

If your goal is to keep all the versions of the same workflow, you need a real version control system such as Git, for example. You can get a free account on GitHub and upload the workflows there instead.

’ is the older version deleted and new uploaded. Does that work for you?’
Yes this will work fine too

@nahidz3 , here’s the updated workflow. However, you need to upgrade n8n to the latest version for it to work. The reason being the latest version has the Google Drive node functionality that allows pulling the files in dedicated folder. Without it, unintended files could be deleted.

Thanks again for the rapid help.
I tried this and facing an error on this step (drive Delete) Screenshot by Lightshot
error is:

@nahidz3 , sorry, I have a typo in the Filter node. Replace the expression {{ $json.drive_name }} with {{ $json.drive_id }}. Updated in the workflow of the previous comment as well.

OK Now it is uploading the workflows, but Not deleting the OLD files first. Infact the Delete node is not even being hit

@nahidz3 , my guess is that only file in the Google Drive does not represent any of the current workflows. The filter did not let it through meaning there is no match for it amongst the current n8n workflows (match is done by the name of the workflows).

Check what that file is, and ensure that the folder holds only workflows. Perhaps you have renamed one of your workflows. There is nothing wrong if you keep other files too but that means they will not be deleted either, which is quite sensible to me.

Try to start from a “clean sheet”. Delete all the files in the dedicated folder and see how it the workflow behaves when you run it a few times. I see no problem when I run the workflow.

Another solution to cater for the workflow rename is to store workflow ID rather than the name. However, I still prefer to use names rather than IDs as it is easier to locate the file you need.

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