addPageTypeField()

Pixelsilk API function to add a new field to a page type--requires the advanced-admin-access permission
Parameters:
pageTypeId: the unique identifier of the page type
fieldName: the name of the new field
fieldType: the type of the new field

Output:
The function addPageTypeField returns a page type field object

C# Example:
Guid pageTypeId = <page type's id>;
string fieldName = "newFieldName";
string fieldType = "newFieldType";
object newField = AddPageTypeField(pageTypeId, fieldName, fieldType);
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/addPageTypeField HTTP/1.1
HOST: www.example.com
Content-Length: 207
Content-Type: application/x-www-form-urlencoded
Cookie: auth=5CB778E9B8D5...111AAF3305EA

Request Data:
Unencoded Data:
json={
   "pageTypeId":"56e7e8e2-fb4a-4aea-8bdb-d335f0e83462",
   "fieldName":"Example",
   "fieldType":"HTML"
}&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=B644AF852B33...309800EA91A; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 153

Response Data:
{"id":"1494c490-5c55-4be0-ab59-f84133e95032",
"name":"Example","defaultField":false,"type":"HTML","defaultValue":null,
"properties":{},"listProperties":{}}

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

Input Object:
{
    pageTypeId:"56e7e8e2-fb4a-4aea-8bdb-d335f0e83462",
    fieldName:"Example",
    fieldType:"HTML"
}

Returned Data:
{
    "id":"e01febed-6015-4d8f-a520-e682923dcb9a",
    "name":"Example",
    "defaultField":false,
    "type":"HTML",
    "defaultValue":null,
    "properties":{
    }
}

Back to Page Types »