setContent()
The Pixelsilk API function setContent updates the content of a section (page) by its path relative to the root. This content is the main content of the section (page).
Parameters:
path: the path to the section (page) relative to the root
value: the actual content to update the section (page) with
Output:
setContent returns the parameter "value" if it is not empty. Otherwise, it returns an empty string.
C# Example:
string content = SetContent(path, value);
Note the capital first letter of the C# method.
HTTP Example:
Request Headers:
POST /api2/setContent HTTP/1.1
HOST: www.example.com
Content-Length: 159
Content-Type: application/x-www-form-urlencoded
Cookie: auth=CB1F098BAB73...A6AFDE47B58A
Request Data:
Unencoded Data:
json={
"path":"/test/",
"value":"The test content has been modified."
}&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=6BD99C779077...4173BE92519; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 37
Response Data:
"The test content has been modified."
JavaScript Example:
Method Call:
pixelsilk2.setContent(input, callback)
Input Object:
{
path:"/TestList/test/",
value:"This is the content of test modified."
}
Returned Data:
"This is the content of test modified."
Back to Content »