createControl()
Pixelsilk API function to add a new control to the site--requires the advanced-admin-access permission
Parameters:
name: the name of the new control
type: the type of the new control
Output:
The function createControl returns an object containing the control's id, the control's name, and the control's type
C# Example:
string name = "newControlName";
string type = "newControlType";
object newControl = CreateControl(name, type);
Note the capital first letter of the C# method.
HTTP Example:
Request Headers:
POST /api2/createControl HTTP/1.1
HOST: www.example.com
Content-Length: 138
Content-Type: application/x-www-form-urlencoded
Cookie: auth=E75659BA9472...920273143252
Request Data:
Unencoded Data:
json={
"name":"ItemDescription",
"type":"HtmlWebbox"
}&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=65E6C8129293...9BC9F0C7632; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 90
Response Data:
{"id":"8f2f327a-25ae-4e0e-ad6f-8cc38dba2ab1", "name":"ItemDescription","type":"HtmlWebbox"}
JavaScript Example:
Method Call:
pixelsilk2.createControl(input, callback)
Input Object:
{
name:"UberHtmlWebbox",
type:"HtmlWebbox"
}
Returned Data:
{
"id":"74456de0-6bb2-4640-b2f3-e9d84d39ae7c",
"name":"UberHtmlWebbox",
"type":"HtmlWebbox"
}
Back to Controls »