httpAction

Runs an HTTP Post request and returns the HTTP response from the server. It works only if with the htttpVerb parameter. Also see httpPost.

The content type provided in the request's header is set by default to application/json. Use this function when the endpoint expects a JSON object parameter.

This is suitable for all modules of business service components.

Syntax

Copy
function httpAction(url: string, body: any, timeout?: number, customHeaders?: any): IFtosHttpResult
function httpAction(url: string, body: any, options?: IFtosHttpGetOptions): IFtosHttpResult
 
Parameter Type Description
url string The service endpoint's URI. For instance, the address of a REST API endpoint.
bodyoptional any Key-value pairs in JSON format to be passed in the request's body.
timeoutoptional number Maximum number of seconds to wait for the HTTP response.
customHeadersoptional any Key-value pairs in JSON format to be passed in the request's custom headers.
options(optional) IFtosHttpGetOptions Additional options to be passed to the HTTP request.

Type Aliases

Return Value

Returns the HTTP response of the HTTP Post request. For example:

Copy
{
    "IsSuccess": true,
    "Response": {
        "NumberOfResults": 0,
        "TotalNumber": 0,
        "RequestedSkip": 0,
        "RequestedTake": 0,
        "Records": [
            {
                "previousBSId": "d056648b-fb96-4210-b253-6de285f27c48",
                "businessStatusId": "cfad132f-d24b-49b3-a7ac-73d5b6905902",
                "nextBusinessStatusId": null,
                "ServerSDKTestid": "e796bdd6-efe6-43e6-b76a-6842d3197735"                
            }
        ],
        "Message": null,
        "IsSuccess": true,
        "ClientScript": null,
        "Serialized": null,
        "ErrorCode": 0,
        "UIResult": null
    },
    "StatusCode": 200
}

If the response is returned in JSON format, the following properties are supported by the return value, corresponding to its first level keys: .IsSuccess, .Response, and .StatusCode.

NOTE  
The Response key in the result is a JSON object, not a string as when using the callGetMethod function.