Child pages
  • PostRequest
Skip to end of metadata
Go to start of metadata


Method Summary
Boolean #addFile(parameterName, fileName, fileLocation)
Add a file to the post.
Boolean #addHeader(headerName, value)
Add a header to the request.
Boolean #addParameter()
Add a parameter to the post.
Response #executeRequest([username], [password])
Execute the request method.
void #setBodyContent(content)
Set the body of the request.
void #setCharset()
Set the charset used when posting.

Method Details
addFile

Boolean addFile (parameterName, fileName, fileLocation)

Add a file to the post.
Parameters
parameterName
fileName
fileLocation
Returns
Boolean
Sample
poster.addFile('myFileParamName','manual.doc','c:/temp/manual_01a.doc')
poster.addFile(null,'postXml.xml','c:/temp/postXml.xml') // sets the xml to post
addHeader

Boolean addHeader (headerName, value)

Add a header to the request.
Parameters
headerName
value
Returns
Boolean
Sample
method.addHeader('Content-type','text/xml; charset=ISO-8859-1')
addParameter

Boolean addParameter ()

Add a parameter to the post.
Returns
Boolean
Sample
poster.addParameter('name','value')
poster.addParameter(null,'value') //sets the content to post
executeRequest

Response executeRequest ([username], [password])

Execute the request method.
Parameters
[username]
[password]
Returns
Response
Sample
var response = method.executeRequest()
setBodyContent

void setBodyContent (content)

Set the body of the request.
Parameters
content
Returns
void
Sample
method.setBodyContent(content)
setCharset

void setCharset ()

Set the charset used when posting. If this is null or not called it will use the default charset (UTF-8).
Returns
void
Sample
var poster = plugins.http.getPoster('https://twitter.com/statuses/update.json');
poster.addParameter('status',globals.textToPost);
poster.addParameter('source','Test Source');
poster.setCharset('UTF-8');
var httpCode = poster.doPost(globals.twitterUserName, globals.twitterPassword); //httpCode 200 is ok
  • No labels