Skip to content

Codeunit WSB_RESTClient

A REST Client used by Apportunix apps to ease making API calls.

Properties

Name Value
Access Public

Methods

wgFncInit

Initializes the REST Client instance with configurations from a setup codeunit.

Parameters

Type Name Description
Interface "WSB_IRESTClientSetup" pWSB_IRESTClientSetup The setup codeunit to retrieve configurations from.

wgFncIsRequestAllowed

Retrieves whether requests are allowed by the user in the current BC environment.

Returns

Type Description
Boolean true if requests are allowed.

wgFncSendRequest

Send a HTTP request given the passed configuration parameters.

Parameters

Type Name Description
Enum "Http Request Type" pMethod The method to use (e.g., GET, POST)
Text pRequestPath The request path (appended after the base-address)
HttpResponseMessage vHttpResponse The response for the request.

Returns

Type Description
Boolean true, if the request was made (false, if, for example, it was blocked).

wgFncSendRequest

Send a HTTP request given the passed configuration parameters.

Parameters

Type Name Description
Enum "Http Request Type" pMethod The method to use (e.g., GET, POST)
Text pRequestPath The request path.
HttpContent pHttpContent The content of the request.
HttpResponseMessage vHttpResponse The response for the request.

Returns

Type Description
Boolean true, if the request was made (false, if, for example, it was blocked).

wgFncSendRequest

Send a HTTP request given the passed configuration parameters.

Parameters

Type Name Description
Enum "Http Request Type" pMethod The method to use (e.g., GET, POST)
Text pRequestPath The request path
Boolean pPrependBaseAddressToRequestPath Specifies whether to prepend the base address to the request path.
HttpContent pHttpContent The content of the request.
HttpResponseMessage vHttpResponse The response for the request.

Returns

Type Description
Boolean true, if the request was made (false, if, for example, it was blocked).

wgFncSetAddAuthorizationHeader

Sets whether or not the authorization header should be added to sent requests.

Parameters

Type Name Description
Boolean pAddAuthHdr Boolean value that indicates whether or not to add the authorization header.

wgFncSetContentHeaders

Sets the HTTP content headers.

Parameters

Type Name Description
Dictionary pContentHeaders The content headers in a dictionary.

wgFncSetContentType

Sets the Content-Type header value for the requests that will be send from the HTTP client.

Parameters

Type Name Description
Text pContentType The Content-Type value

wgFncSetDefaultHeaders

Sets the HTTP default request headers.

Parameters

Type Name Description
Dictionary pDefaultHeaders The default request headers in a dictionary.

wgFncSetErrorOnFailedRequest

Sets whether to throw an error if sending the request failed (e.g., due to it being blocked by Business Central).

Parameters

Type Name Description
Boolean pErrorOnFailedRequest Boolean value that indicates whether or not to throw an error.

wgFncSetRequestHeaders

Sets the HTTP request headers.

Parameters

Type Name Description
Dictionary pRequestHeaders The request headers in a dictionary.