Get Method

This method is used to request data from a specified resource without modifying it.

Client support

   Newlook Smartclient

   Newlook Server

Version Support

Introduced in Version 10.7 (Newlook Server API).

Introduced in Version 11.0 (Scripting support).

Syntax

HTTP.Get(Url[, Params][, DataType])

The Get method syntax has these parameters:

Part

Description

URL

String expression that specifies the URL of the server-based resource.

Params

Optional. A structure of name/value pairs containing the parameters to be passed to the routine.

DataType

Optional. DataType Constant specifying how Newlook should interpret the returned content. This method assumes the response will consist of a UTF8 string (regardless of the Content-Type in the response header). The dataType parameter is then used to determine if the content will be parsed as JSON or returned as literal text. If omitted, nlHttpDataTypeAutoDetect is used.

Settings

The available dataType constants:

Constant

Value

Description

nlHttpDataTypeAutoDetect

0

Detect the content type from the response's Content-Type header (default).

nlHttpDataTypeText

1

Newlook will ignore the Content-Type in the response header and return the content as a string.

nlHttpDataTypeJson

2

Newlook will ignore the Content-Type in the response header and attempt to convert the returned data to a JSON object.

Returns

In the case where the dataType argument is set to nlHttpDataTypeAutoDetect and we don't detect a JSON payload or the dataType is set to nlHttpDataTypeText, then this method returns a string.

Where a JSON payload is detected, the Get method can return the following types:

If you are using this method in a JScript script and the returned content is an array, you will need to convert the returned value to a JScript array using the VBArray(...).toArray() method (see second example below).

Use

It is important to note that his method only supports UTF-8 encoded responses (regardless of media type).

See Also

WebCall method

Applies To

HTTP object


© 2004-2021 looksoftware. All rights reserved.