addSection()

Pixelsilk API function to add a new section (page)--requires the add-page permission
Parameters:
For the typeId parameter below, only use the ID for a Page Type the Pixelsilk user interface actually makes available in the Add Page area.

name: the name of the section (page) to add
parentId: the unique identifier of the section to serve as the parent of the new section
typeId: the unique identifier of the type for the new section

Output:
The function addSection returns an object containing minimal information about the new section

C# Example:
string name = "nameOfNewSection";
string parentId = "idOfParentSection";
string typeId = "idOfTypeOfNewSection";
object newSecionObject = AddSection(name, parentId, typeId);
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/addSection HTTP/1.1
HOST: www.example.com
Content-Length: 235
Content-Type: application/x-www-form-urlencoded
Cookie: auth=F9FB1D84D8F6...2DBAB8FE90C6

Request Data:
Unencoded Data:
json={
   "name":"exampletest3",
   "parentId":"03754619-b71b-47e7-866d-4f7856c081a0",
   "typeId":"C4A3A3A2-802F-4FB2-9680-AF65C6607DDA" 
}&token=7AdbNHZQBtwc...RPTEK8UvSUQ=

Url-encoded Data:
json=%7b%0d%0a+++...22+%0d%0a%7d&token=7AdbNHZQBtwc...TEK8UvSUQ%3d

Response Headers:
HTTP/1.1 200 OK
Set-Cookie: auth=AE2AFF3A88D0...B5867D45FFE; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 502

Response Data:
{
  "menuName":"exampletest3",
  "id":"414875f8-49a3-4172-a59c-a18e061cdfad",
  "urlRelative":"/test/ralphtest1/exampletest3/",
  "enabled":true,
  "displayInNav":true,
  "includeInHtmlSiteMap":true,
  "approved":true,
  "typeImage":"Articles",
  "typeName":"TestSection",
  "children":[
  ],
  "inheritSecurityFromParent":true,
  "inheritOptionsFromParent":true,
  "inheritUrlSettingsFromParent":true,
  "inheritAdvancedStettingsFromParent":true,
  "shouldBeEnabled":true,
  "shouldBeDisplayedInNav":true,
  "shouldBeVisibleInSiteMap":true,
  "isRoot":false
}

JavaScript Example:
Method Call:
pixelsilk2.addSection(input, callback);

Input Object:
{
    name:"AddExample",
    parentId:"be799b8b-e177-47fc-97dc-d10a1d2202a1",
    typeId:"598ff8a5-e303-4e19-bc5c-461413d044ed"
}

Returned Data:
{
    "menuName":"AddExample",
    "id":"ad73bebe-694c-4c5a-9150-cfd0494cafdd",
    "urlRelative":"/Foo/AddExample/",
    "enabled":false,
    "displayInNav":true,
    "includeInHtmlSiteMap":true,
    "approved":true,
    "typeImage":"Articles",
    "typeName":"APIListSection",
    "children":[
    ],
    "inheritSecurityFromParent":true,
    "inheritOptionsFromParent":false,
    "inheritUrlSettingsFromParent":true,
    "inheritAdvancedStettingsFromParent":true,
    "shouldBeEnabled":false,
    "shouldBeDisplayedInNav":true,
    "shouldBeVisibleInSiteMap":true,
    "isRoot":false
}

Back to Pages »