We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

jmarbutt's avatar
jmarbutt
New member | Level 2
4 days ago

Invalid Folder Name with Team API

I am trying to create folders using the api in a team folder like this:


// Get Namespace ID
const dbx = new Dropbox({ accessToken: process.env.DROPBOX_ACCESS_TOKEN });

 

const baseFolder = "/Data Transfers";
const customerFolder = `${baseFolder}/${folder_name}`;
const dataFolder = `${customerFolder}/data`;



// Create a folder in dropbox
await step.run('create-customer-folder', async () => {
console.log(customerFolder);
await dbx.teamTeamFolderCreate({ name: customerFolder });
await dbx.filesCreateFolderV2({ path: dataFolder });
});





This should be just to create a folder under our team /Data Transfers/TestFolder but it is giving me an Invalid Folder name, what am I doing wrong? I am just getting started with the API and I am completely lost. 

  • iNeil's avatar
    iNeil
    Icon for Dropbox Engineer rankDropbox Engineer

    Hi jmarbutt,

    Based on the information you provided, you would like to create a folder within your team folder. The error message “invalid_folder_name” would occur if the name you provided is not valid for creating a team folder when using the 2/team/team_folder/create endpoint.

     

    That said, to create a folder within your team folder, you should use the 2/files/create_folder_v2 endpoint and not the 2/team/team_folder/create Endpoint. Please test the conditions while using the 2/files/create_folder_v2 endpoint to create a folder within your team folder.

    If your account is connected to an updated team space configuration, please bear in mind, by default the API calls to the Dropbox API operates in the "member folder" of the connected account and not the "team space" where team folders are located. You can configure API calls to operate in the "team space" by setting the "Dropbox-API-Path-Root" header with your Dropbox API request. For further information, please review the following link: