Codeunit "Http Request Message"
Holder object for the HTTP request data.
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
Create
Creates a new instance of the HttpRequestMessage object.
procedure Create(Method: Enum "Http Method", RequestUri: Text, Content: Codeunit "Http Content"): Codeunit "Http Request Message"
Parameters
| Name | Type | Description |
|---|---|---|
| Method | Enum System.RestClient."Http Method" |
The HTTP method to use. Valid options are GET, POST, PATCH, PUT, DELETE, HEAD, OPTIONS |
| RequestUri | Text |
The Uri to use for the HTTP request. |
| Content | Codeunit System.RestClient."Http Content" |
The Http Content object to use for the HTTP request. |
Returns
| Type | Description |
|---|---|
| Codeunit System.RestClient."Http Request Message" |
The create Http Request Message |
SetHttpMethod
Sets the HTTP method or the HttpRequestMessage object.
procedure SetHttpMethod(Method: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| Method | Text |
The HTTP method to use. Valid options are GET, POST, PATCH, PUT, DELETE, HEAD, OPTIONS |
Remarks
Default method is GET
SetHttpMethod
Sets the HTTP method for the HttpRequestMessage object.
procedure SetHttpMethod(Method: Enum "Http Method")
Parameters
| Name | Type | Description |
|---|---|---|
| Method | Enum System.RestClient."Http Method" |
The HTTP method to use. |
Remarks
Default method is GET
GetHttpMethod
Gets the HTTP method for the HttpRequestMessage object.
procedure GetHttpMethod(): Text
Returns
| Type | Description |
|---|---|
| Text |
The HTTP method for the HttpRequestMessage object. |
SetRequestUri
Sets the Uri used for the HttpRequestMessage object.
procedure SetRequestUri(Uri: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| Uri | Text |
The Uri to use for the HTTP request. |
Remarks
The valued must not be a relative URI.
GetRequestUri
Gets the Uri used for the HttpRequestMessage object.
procedure GetRequestUri(): Text
Returns
| Type | Description |
|---|---|
| Text |
The Uri used for the HttpRequestMessage object. |
SetHeader
Sets a new value for an existing header of the Http Request object, or addds the header if it does not already exist.
procedure SetHeader(HeaderName: Text, HeaderValue: Text)
Parameters
| Name | Type | Description |
|---|---|---|
| HeaderName | Text |
The name of the header to add. |
| HeaderValue | Text |
The value of the header to add. |
SetHeader
Sets a new value for an existing header of the Http Request object, or addds the header if it does not already exist.
procedure SetHeader(HeaderName: Text, HeaderValue: SecretText)
Parameters
| Name | Type | Description |
|---|---|---|
| HeaderName | Text |
The name of the header to add. |
| HeaderValue | SecretText |
The value of the header to add. |
GetHeaderValues
Gets the values of the header with the given name from the HttpRequestMessage object.
procedure GetHeaderValues(HeaderName: Text): List of [Text]
Parameters
| Name | Type | Description |
|---|---|---|
| HeaderName | Text |
The name of the header to get. |
Returns
| Type | Description |
|---|---|
| List of [Text] |
A list of values of the header with the given name. |
Remarks
If the header is not found, an empty list is returned.
GetSecretHeaderValues
Gets the secret values of the header with the given name from the HttpRequestMessage object.
procedure GetSecretHeaderValues(HeaderName: Text): List of [SecretText]
Parameters
| Name | Type | Description |
|---|---|---|
| HeaderName | Text |
The name of the header to get. |
Returns
| Type | Description |
|---|---|
| List of [SecretText] |
A list of values of the header with the given name. |
Remarks
If the header is not found, an empty list is returned.
SetCookie
Sets the cookie given a name and value
procedure SetCookie(Name: Text, Value: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Name | Text |
The name of the cookie to set. |
| Value | Text |
The value of the cookie to set. |
Returns
| Type | Description |
|---|---|
| Boolean |
SetCookie
Sets the cookie given a cookie object
procedure SetCookie(Cookie: Cookie): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Cookie | Cookie |
The cookie object to set. |
Returns
| Type | Description |
|---|---|
| Boolean |
GetCookieNames
Gets the names of the cookies that are set in the HttpRequestMessage object.
procedure GetCookieNames(): List of [Text]
Returns
| Type | Description |
|---|---|
| List of [Text] |
The names of the cookies that are set in the HttpRequestMessage object. |
GetCookies
Gets the cookies that are set in the HttpRequestMessage object.
procedure GetCookies(): List of [Cookie]
Returns
| Type | Description |
|---|---|
| List of [Cookie] |
The cookies that are set in the HttpRequestMessage object. |
GetCookie
Gets the cookie with the given name from the HttpRequestMessage object.
procedure GetCookie(Name: Text): Cookie
Parameters
| Name | Type | Description |
|---|---|---|
| Name | Text |
The name of the cookie to get. |
Returns
| Type | Description |
|---|---|
| Cookie |
The cookie object. |
Remarks
If the cookie is not found, an empty cookie object is returned.
GetCookie
Gets the cookie with the given name from the HttpRequestMessage object.
procedure GetCookie(Name: Text, var Cookie: Cookie): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Name | Text |
The name of the cookie to get. |
| Cookie | Cookie |
The cookie object to get. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the cookie was found, false otherwise. |
RemoveCookie
Removes the cookie with the given name from the HttpRequestMessage object.
procedure RemoveCookie(Name: Text): Boolean
Parameters
| Name | Type | Description |
|---|---|---|
| Name | Text |
The name of the cookie to remove. |
Returns
| Type | Description |
|---|---|
| Boolean |
True if the cookie was removed, false otherwise. |
SetHttpRequestMessage
Sets the HttpRequestMessage that is represented by the HttpRequestMessage object.
procedure SetHttpRequestMessage(var RequestMessage: HttpRequestMessage)
Parameters
| Name | Type | Description |
|---|---|---|
| RequestMessage | HttpRequestMessage |
The HttpRequestMessage to set. |
GetHttpRequestMessage
Gets the HttpRequestMessage that is represented by the HttpRequestMessage object.
procedure GetHttpRequestMessage(): HttpRequestMessage
Returns
| Type | Description |
|---|---|
| HttpRequestMessage |
The HttpRequestMessage that is represented by the HttpRequestMessage object. |
SetContent
Sets the content of the HttpRequestMessage that is represented by the HttpRequestMessage object.
procedure SetContent(HttpContent: Codeunit "Http Content")
Parameters
| Name | Type | Description |
|---|---|---|
| HttpContent | Codeunit System.RestClient."Http Content" |
The Http Content object to set. |