addPageTypeField()

Pixelsilk API function to add a new field to a page type--calls the other method by the same name--requires the advanced-admin-access permission
Parameters:
pageTypeId: the page type's unique identifier 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:
string pageTypeId = "idOfPageType";
string fieldName = "nameOfField";
string fieldType = "typeOfField";
object pageTypeField = 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=F93436AAEB25...A344F4BC9384

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=96B4E3C8A1EA...4FC8A38F616; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 153

Response Data:
{"id":"0beacaeb-6c42-4b6b-9771-2cd48b54e4f6","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 »