CCAPI Page

From ADF Docs
Jump to: navigation, search

Overview

The Create Page library utility allows you to easily create and delete CommonSpot pages using the CCAPI. The utility works similarly to the standard out of the box CCAPI samples found in the /commonspot/samples/contentCreationAPI/ directory except it is simpler to use.

Example Usage

<cfscript>
  // create the standard metadata
  stdMetadata = structNew();
  stdMetadata["name"] = "My Page Name";
  stdMetadata["title"] = "My Page Title";
  stdMetadata["templateID"]= 1023;
  stdMetadata["subsiteID"] = 12;
  custMetadata = structNew();
  custMetadata["formName"] = structNew();
  custMetadata["formName"]["fieldName"] = "value 1";
  // create the page CFC
  csPage = server.ADF.getBean("CSPage_1_0");
  // create the page
  csPage.createPage(stdMetadata, custMetadata);
</cfscript>
<cfscript>
  // create the deleted page data
  tmp = structNew();
  tmp["pageID"] = 22323;
  tmp["subsiteID"] = 122;
  // create the page CFC
  csPage = server.ADF.getBean("CSPage_1_0");
  // create the page
  csPage.deletePage(tmp);
</cfscript>


Note: You must provide the following fields in stdMetadata to ensure success:

  • Name (this will be converted to a valid name for you)
  • Title (this is limited to 255 characters)
  • SubsiteID (where do you want your page to be created)
  • TemplateID (the page your page should be created from

All other field for Standard Metadata are optional.