Table of Contents

Codeunit "Http Content"

ID 2354
Namespace: System.RestClient

Holder object for the Http Content data.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

Create

Initializes a new instance of the Http Content class with the specified Text content.

procedure Create(Content: Text): Codeunit "Http Content"

Parameters

Name Type Description
Content Text

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'text/plain'.

Create

Initializes a new instance of the Http Content class with the specified SecretText content.

procedure Create(Content: SecretText): Codeunit "Http Content"

Parameters

Name Type Description
Content SecretText

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'text/plain'.

Create

Initializes a new instance of the Http Content class with the specified Text content and content type.

procedure Create(Content: Text, ContentType: Text): Codeunit "Http Content"

Parameters

Name Type Description
Content Text

The content to send to the server.

ContentType Text

The content type of the content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

If the ContentType parameter is not specified, it will be set to 'text/plain'.

Create

Initializes a new instance of the Http Content class with the specified SecretText content and content type.

procedure Create(Content: SecretText, ContentType: Text): Codeunit "Http Content"

Parameters

Name Type Description
Content SecretText

The content to send to the server.

ContentType Text

The content type of the content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

If the ContentType parameter is not specified, it will be set to 'text/plain'.

Create

Initializes a new instance of the Http Content class with the specified JsonObject content.

procedure Create(Content: JsonObject): Codeunit "Http Content"

Parameters

Name Type Description
Content JsonObject

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'application/json'.

Create

Initializes a new instance of the Http Content class with the specified JsonArray content.

procedure Create(Content: JsonArray): Codeunit "Http Content"

Parameters

Name Type Description
Content JsonArray

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'application/json'.

Create

Initializes a new instance of the Http Content class with the specified JsonToken content.

procedure Create(Content: JsonToken): Codeunit "Http Content"

Parameters

Name Type Description
Content JsonToken

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'application/json'.

Create

Initializes a new instance of the Http Content class with the specified XmlDocument content.

procedure Create(Content: XmlDocument): Codeunit "Http Content"

Parameters

Name Type Description
Content XmlDocument

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'text/xml'.

Create

Initializes a new instance of the Http Content class with the specified "Temp Blob" Codeunit content.

procedure Create(Content: Codeunit "Temp Blob"): Codeunit "Http Content"

Parameters

Name Type Description
Content System.Utilities."Temp Blob"

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'application/octet-stream'.

Create

Initializes a new instance of the Http Content class with the specified "Temp Blob" Codeunit content and content type.

procedure Create(Content: Codeunit "Temp Blob", ContentType: Text): Codeunit "Http Content"

Parameters

Name Type Description
Content System.Utilities."Temp Blob"

The content to send to the server.

ContentType Text

The content type of the content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

If the ContentType parameter is not specified, it will be set to 'application/octet-stream'.

Create

Initializes a new instance of the Http Content class with the specified InStream content.

procedure Create(Content: InStream): Codeunit "Http Content"

Parameters

Name Type Description
Content InStream

The content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

The Content-Type header will be set to 'application/octet-stream'.

Create

Initializes a new instance of the Http Content class with the specified InStream content and content type.

procedure Create(Content: InStream, ContentType: Text): Codeunit "Http Content"

Parameters

Name Type Description
Content InStream

The content to send to the server.

ContentType Text

The content type of the content to send to the server.

Returns

Type Description
System.RestClient."Http Content"

The Http Content object.

Remarks

If the ContentType parameter is not specified, it will be set to 'application/octet-stream'.

Create

Initializes a new instance of the Http Content object with the specified HttpContent object.

procedure Create(Content: HttpContent): Codeunit "Http Content"

Parameters

Name Type Description
Content HttpContent

The HttpContent object.

Returns

Type Description
System.RestClient."Http Content"

The HttpContent object.

Remarks

The HttpContent must be properly prepared including the Content-Type header.

SetContentTypeHeader

Sets the Content-Type header of the HttpContent object.

procedure SetContentTypeHeader(ContentType: Text)

Parameters

Name Type Description
ContentType Text

The value of the header to add.

Remarks

If the header already exists, it will be overwritten.

AddContentEncoding

Sets the Content-Encoding header of the HttpContent object.

procedure AddContentEncoding(ContentEncoding: Text)

Parameters

Name Type Description
ContentEncoding Text

The value of the header to add.

Remarks

If the header already exists, the value will be added to the end of the list.

SetHeader

Sets a new value for an existing header of the HttpContent object, or adds the header if it does not already exist.

procedure SetHeader(Name: Text, Value: Text)

Parameters

Name Type Description
Name Text

The name of the header to add.

Value Text

The value of the header to add.

SetHeader

Sets a new value for an existing header of the HttpContent object, or adds the header if it does not already exist.

procedure SetHeader(Name: Text, Value: SecretText)

Parameters

Name Type Description
Name Text

The name of the header to add.

Value SecretText

The value of the header to add.

GetHttpContent

Gets the HttpContent object.

procedure GetHttpContent(): HttpContent

Returns

Type Description
HttpContent

The HttpContent object.

AsText

Gets the content of the HTTP response message as a string.

procedure AsText(): Text

Returns

Type Description
Text

The content of the HTTP response message as a string.

AsSecretText

Gets the content of the HTTP response message as a SecretText.

procedure AsSecretText(): SecretText

Returns

Type Description
SecretText

The content of the HTTP response message as a SecretText.

AsBlob

Gets the content of the HTTP response message as a "Temp Blob" Codeunit.

procedure AsBlob(): Codeunit "Temp Blob"

Returns

Type Description
System.Utilities."Temp Blob"

The content of the HTTP response message as a "Temp Blob" Codeunit.

AsInStream

Gets the content of the HTTP response message as an InStream.

procedure AsInStream(): InStream

Returns

Type Description
InStream

The content of the HTTP response message as an InStream.

AsXmlDocument

Gets the content of the HTTP response message as an XmlDocument.

procedure AsXmlDocument(): XmlDocument

Returns

Type Description
XmlDocument

The content of the HTTP response message as an XmlDocument.

Remarks

Fails in case the content is not a valid XML document.

AsJson

Gets the content of the HTTP response message as a JsonToken.

procedure AsJson(): JsonToken

Returns

Type Description
JsonToken

The content of the HTTP response message as a JsonToken.

Remarks

Returns an empty JsonToken in case there is no content. Fails in case the content is not a valid JSON document.

AsJsonObject

Gets the content of the HTTP response message as a JsonObject.

procedure AsJsonObject(): JsonObject

Returns

Type Description
JsonObject

The content of the HTTP response message as a JsonObject.

Remarks

Returns an empty JsonObject in case there is no content. Fails in case the content is not a valid JSON document.

AsJsonArray

Gets the content of the HTTP response message as a JsonArray.

procedure AsJsonArray(): JsonArray

Returns

Type Description
JsonArray

The content of the HTTP response message as a JsonArray.

Remarks

Returns an empty JsonArray in case there is no content. Fails in case the content is not a valid JSON document.

See also