Skip to main content

HTTPClient Object

Last updated 24/10/2023

The HTTPClient object on the five object provides many ways to interact with existing web content using the http protocol or the builtin headless web browser.

Five provides two modes to interact with an external API.

  • RAW - This is straight text or JSON from the server.
  • INTERACTIVE - This is a full headless web browser session.

Functions

The following functions can used on the httpClient object on the five object.

addData()

The addData() is a function that adds a key value pair to the body of the post request, or as URL encoded URL parameters for a get request when using RAW mode for the get and post methods and returns null on success.

Function Signature
addData(key: string, value: string) : FiveError;

get()

The get() is a function that will issue a get request to the server.

Function Signature
get([mode: string,] url: string) : HTTPResponse | BrowserPage;

addHeader()

The addHeader() is a function

Function Signature
addHeader() : string;

post()

The post() is a function

Function Signature
post() : string;

setBasicAuthentication ()

The setBasicAuthentication() is a function

Function Signature
setBasicAuthentication() : string;

setContent()

The setContent() is a function

Function Signature
setContent() : string;

setContentType()

The setContentType() is a function

Function Signature
setContentType() : string;

setOutputFilename()

The setOutputFilename() is a function

Function Signature
setOutputFilename() : string;