addPageTypeFieldValue()

Pixelsilk API function to add a value to a field's values--requires the advanced-admin-access permission
Parameters:
pageTypeId: the page type's unique identifier
fieldId: the field's unique identifier
listValue: the field's value
listText: the field's display text

Output:
The function addPageTypeFieldValue returns an item list properties object containing the page type field where this propery belongs, the list text, the list value, the list order, whether it is the default, and whether it is selected

C# Example:
Guid pageTypeId = <page type's id>;
Guid fieldId = <field's id>;
string listValue = "valueOfField";
string listText = "displayTextOfField";
object itemListPropeties = AddPageTypeFieldValue(pageTypeId, fieldId, listValue, listText);
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/addPageTypeFieldValue HTTP/1.1
HOST: www.example.com
Content-Length: 291
Content-Type: application/x-www-form-urlencoded
Cookie: auth=27B07165257D...B948556AE44B

Request Data:
Unencoded Data:
json={
   "pageTypeId":"031ce0ac-24c1-4254-a7ec-82a4d7fe5c8e",
   "fieldId":"325770a4-5d4c-46eb-a7b1-3780efac8c78",
   "listValue":"Example",
   "listText":"Here is an example."
}&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=E2A48C7E4B81...97BC497DC71; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 100

Response Data:
{"id":"f21c5aa0-f672-4379-8510-048157a7a19f","listText":"Here is an example.","listValue":"Example"}

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

Input Object:
{
    pageTypeId:"031ce0ac-24c1-4254-a7ec-82a4d7fe5c8e",
    fieldId:"325770a4-5d4c-46eb-a7b1-3780efac8c78",
    listValue:"Example",
    listText:"Here is some example text."
}

Returned Data:
{
    "id":"cf568c00-1722-483f-8179-3628283f4996",
    "listText":"Here is some example text.",
    "listValue":"Example"
}

Back to Page Types »