Skip to main content
Used to retrieve the result of a URL.

Constructors

HTTP()

Initializes a new instance of the HTTP class.

Methods

addAttachmentData(Integer)

Adds the binary data in the Service attachment specified to the body of the request.
Returns: CRMScript.Global.Bool - True if the attachment was found; otherwise, false.
Must be used together with POST, PUT or PATCH.Many REST endpoints expect the content to be uploaded as binary data when adding files. You can use this method for doing that. automatically set the Content-Type header based on the content type recorded in the database for the attachment. If you want to override the Content-Type, be sure to set a Content-Type header after doing the addAttachmentData call.
Example:

addBinaryData(Byte[])

Adds the binary data to the body of the request.
Returns: CRMScript.Global.Void
Must be used together with POST, PUT or PATCH.Many REST endpoints expect the content to be uploaded as binary data when adding files. You can use this method for doing that. Normally, you also want to add a Content-Type header, indicating what kind of files this is.
Example:

addDocumentData(Integer)

Add the binary data in the document specified to the body of the request.
Returns: CRMScript.Global.Bool - True if the document was found; otherwise, false.
Must be used together with POST, PUT or PATCH.Many REST endpoints expect the content to be uploaded as binary data when adding files. You can use this method for doing that. automatically set the Content-Type header based on the extension of the document being added. If you want to override the Content-Type, be sure to set a Content-Type header after doing the addDocumentData call.
Example:

addHeader(String,String)

Adds a new header. The new header will be placed after other existing headers.
Returns: CRMScript.Global.Void Example:

delete(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.Global.Byte[] - The result in a byte array. Example:

deleteAsStream(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.NetServer.NSStream Example:

get(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.Global.Byte[] - The result in a byte array. Example:

getAsStream(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.NetServer.NSStream - The result. Example:

getDebug()

Retrieves debug output.
Returns: CRMScript.Global.String - The debug output.
Turn on debug mode by calling setDebugMode(true) before you use getDebug().

getErrorMessage()

Returns the last error message.
Returns: CRMScript.Global.String - The last error message. Example:

getResponseHeader(String)

Gets a named HTTP header from the response of the HTTP request.
Returns: CRMScript.Global.String - The header.
Case insensitive.

getResponseHeaders()

Gets a map of all the headers from the HTTP response headers after making a HTTP call.
Returns: CRMScript.Native.Map - A map of all the headers from the HTTP response headers after making a HTTP call.
The key is in lower case regardless of what was returned by the response. The value will keep the case.

getValue(String)

General function which returns various values from the instance.
Returns: CRMScript.Global.String - Values from the instance.
statusCode: Will return the status code from the HTTP request (such as 404, 200). Supported from v8.0sr3.

hasError()

Checks if there was an error in the environment.
Returns: CRMScript.Global.Bool - True if there was an error in the environment; otherwise, false.

open(String)

Opens a URL and returns the result as a Byte array.
Returns: CRMScript.Global.Byte[] - Result as a Byte array. Example:

openAsStream(String)

Opens a URL and returns the result as an NSStream.
Returns: CRMScript.NetServer.NSStream Example:

patch(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.Global.Byte[] - The result as a byte array. Example:

patchAsStream(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.NetServer.NSStream - The result. Example:

post(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.Global.Byte[] - The result as a byte array. Example:

postAsStream(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.NetServer.NSStream - The result. Example:

putAsStream(String)

Supports both HTTP and HTTPS.
Returns: CRMScript.NetServer.NSStream - The result. Example:

setDebugMode()

Turns debug mode on/off to record debug output.
Returns: CRMScript.Global.Void

setOption(String,Bool)

Option function.
Returns: CRMScript.Global.Void
Example:

setValue(String,String)

Adds a CGI variable and its according value to the HTTP request.
Returns: CRMScript.Global.Void Example: