Modifying the Base Folder of a site

Justin "JET" Turner's Avatar

Justin "JET" Turner

11 Jun, 2013 08:12 PM

Hello Again,

I am trying to use web services to modify the title metadata on the "Base Folder" of a site. We use this title field when building breadcrumbs for the site.

I am getting the error: Either one of parentFolderId, parentFolderPath is required. which of course, the Base Folder doesn't have a parent. I did test my code on a folder further down in the site, and it worked just fine.

In the below code, I am passing '\' as the $item, which does retrieve the Base Folder, but after making changes and trying to push the edit back, I get the before mentioned error.

function modifyFolderTitle($item, $newTitle)
    global $auth, $client, $siteName;
    $identifier = array
        'path' => array(
            path => $item,
            siteName => $siteName),
        'type' => 'folder'
    $readParams = array ('authentication' => $auth, 'identifier' => $identifier);
    $reply = $client->read($readParams);
        $asset = $reply->readReturn->asset->folder;
        $asset->metadata->title = $newTitle;
        $editParams = array('authentication' => $auth, 'asset' => array('folder' => $asset));
        $reply = $client->edit($editParams);
            echo ' <span style="font-weight:bold; color:#0F0;">Success</span><br>';
            echo ' <span style="font-weight:bold; color:#F00;">Fail</span>'.$reply->editReturn->message.'<br>';
        echo ' <span style="font-weight:bold; color:#F00;">Fail</span>'.$reply->readReturn->message.'<br>';
  1. 1 Posted by Ryan Griffith on 12 Jun, 2013 01:28 PM

    Ryan Griffith's Avatar

    Hi Justin,

    Base Folder seems to be a little strange, you would think not specifying either parentFolderId and parentFolderPath for the Base Folder would be allowed. Let me check with the developers to see if there's a reason for this.

    That being said, I was able to get the edit operation to work by setting parentFolderId to the string NULL in the following way:

    $asset->parentFolderId = "NULL";

    It looks like your function is generic, so what you could do is check the Folder's name or path to see if it equals /, and if so, set the parentFolderId to the string NULL.

    Note: simply using the NULL reserved word does not seem to work, so make sure you are using a string.

    Please let me know if you have any questions.


  2. 2 Posted by Justin &quot;JE... on 12 Jun, 2013 01:43 PM

    Justin &quot;JET&quot; Turner's Avatar

    I had actually just added an if statement for the root folder to store the folder ID for an index block I'm building in the same set of code, so I added the line you mentioned above and its working great!

    This was the last piece to wrap up automating our site creation steps. Thanks for your help!
    We now have a web form my team can fill out, that kicks off the script that creates a group, a site, sets site url's, publishing and roles, sets permissions, enables asset factories to the newly created group, configures destinations, adjusts some generic workflows, modifies a few base assets, creates a home page, adds the home page to a menu block, sets the department name for breadcrumbs, adds the site to the sitemap, and publishes the site and site map.

    It was over 100 steps on paper, but with a couple days of work, and a little over 750 lines of code, it is down to fill out a web form and click submit. I wish we had time to tackle web services back when we first got started with Cascade.

  3. Justin "JET" Turner closed this discussion on 12 Jun, 2013 01:43 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac