Adding a Configuration to a Config Set (Web Services)

thugsb's Avatar

thugsb

18 Oct, 2012 02:44 PM

I want to add a new configuration to a config set. Would I use the edit or create operation?

I've been trying to use 'create' using the following PHP:

    $newConf = array (
      'name' => 'MobileIA',
      'parentContainerId' => 'cd6e45fd7f00000101f92de5d6fabf90',
      'templateId' => 'a4a773567f00000229bbbce6260f114b',
      'templatePath' => '_cms/templates/Level 2 MobileDD',
      'outputExtension' => '.html',
      'serializationType' => 'HTML',
      'publishable' => '1',
      'defaultConfiguration' => '' // I've also tried it with the other config fields: pageRegions, includeXMLDeclaration, etc.
    );
    $newAsset = array( 'pageConfiguration' => $newConf );
    $create = $client->create ( array ('authentication' => $auth, 'asset' => $newAsset ) );

However, it's giving me this error: http://d.pr/n/HK3A
Thanks for the help!

  1. 1 Posted by thugsb on 18 Oct, 2012 04:09 PM

    thugsb's Avatar

    Do I also need 'roleType' => 'site', and 'siteAbilities' => 'editPageLevelConfigurations' (or something)? They also don't allow it to work.

    I see in the XML reference it refers to <!-- complex type wrapping a list of page configurations --><complexType name="page-configurations">. This is in addition to pageConfigurationSet (the parent asset I'm trying to add the new config to) and pageConfiguration (the thing I'm trying to add). Do I need to use page-configurations somehow? If so, how? Thanks!

  2. 2 Posted by thugsb on 18 Oct, 2012 05:32 PM

    thugsb's Avatar

    Can the Web Services AssetOperationService only create these asset-types: workflowConfiguration, feedBlock, indexBlock, textBlock, xhtmlDataDefinitionBlock, xmlBlock, file, folder, page, reference, xsltFormat, scriptFormat? (They are the listed types in the error that's being thrown).

    Also, I should probably clarify: the ID for the parentContainerId given is the ID of the pageConfigurationSet.

  3. 3 Posted by Ryan Griffith on 18 Oct, 2012 05:59 PM

    Ryan Griffith's Avatar

    Hi,

    If the Configuration Set already exists, I think your best bet would be to read the existing Configuration Set cd6e45fd7f00000101f92de5d6fabf90, rebuild the array, and pass it into the edit operation.

    So you would rebuild a Configuration Set array based on the read and append the new Configuration to it's pageConfigurations sub-array. Then you would pass this new re-build array it into the edit() operation to update the existing Configuration Set. If the Configuration Set does not exist, then you would need to build it from scratch.

    Note: if you wish to "pre-fill" the template regions as well, you would use the pageRegions element.

    Please let me know if you have any questions.

    Thanks

  4. 4 Posted by thugsb on 18 Oct, 2012 06:21 PM

    thugsb's Avatar

    OK, thanks, I'll have a go tomorrow and close this if it works. Will an ID for the new configuration be automatically created?

  5. 5 Posted by Ryan Griffith on 18 Oct, 2012 06:26 PM

    Ryan Griffith's Avatar

    Good luck, let us know if you have any questions.

    Will an ID for the new configuration be automatically created?

    Correct, the configuration ID is generated automatically when it is added to the configuration set through the edit operation.

  6. 6 Posted by thugsb on 22 Oct, 2012 05:28 PM

    thugsb's Avatar

    Yep, edit worked perfectly, using this:

      $newConf = new stdClass();
      $newConf->name = 'MobileIA'; 
      $newConf->templateId = 'a4a773567f00000229bbbce6260f114b';
      $newConf->outputExtension = '-ia.html';
      $newConf->serializationType = 'HTML';
      $newConf->publishable = '1';
      $newConf->defaultConfiguration = '';
    
      array_push($asset['pageConfigurations']->pageConfiguration, $newConf);
    
  7. thugsb closed this discussion on 22 Oct, 2012 05:29 PM.

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

Keyboard shortcuts

Generic

? 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