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
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
Allows you to define the HTTP request's additional options.
{
additionalHeaders? : any;
clientCertificate? : WorkflowClientCertificate;
httpVerb? : string;
multipartArguments? : IFtosHttpPostMultiPartArgument[];
responseType? : "Default" | "String" | "JSON" | "ByteArray";
timeout? : number;
}
| Property | Type | Description |
|---|---|---|
additionalHeaders(optional)
|
any | Key-value pairs in JSON format to be passed as the request's custom headers. |
clientCertificate(optional)
|
WorkflowClientCertificate | Registered client certificate required for client authentication via TLS/SSL. For information on how to register client certificates, see the Platform documentation. For information on how to retrieve a registered client certificate, see ftos.utils.getCertificate. |
httpVerb(optional)
|
string | Allows you to use an HTTP request method different from POST, such as GET, DELETE, etc. |
multipartArguments(optional)
|
IFtosHttpPostMultiPartArgument[] | Allows you to define settings for HTTP range requests when sending multpart documents over the network. |
responseType(optional)
|
"Default" | "String" | "JSON" | "ByteArray" | The format in which the HTTP response will be returned:
|
timeout(optional)
|
number | Maximum number of seconds to wait for the HTTP response. |
Allows you to define settings for HTTP range requests when sending multpart documents over the network.
{
bytes : number[];
contentType : string;
fileName : string;
name : string;
}
| Property | Type | Description |
|---|---|---|
bytes
|
number[] | Indicates the range of bytes retrieved from the server. |
contentType
|
string | Value of the Content-Type header of the HTTP request. |
fileName
|
string | Name of the file transmitted. |
name
|
string | Name of the HTML field transmitted. |
Return Value
Returns the HTTP response of the HTTP Post request. For example:
{
"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.
The
Response key in the result is a JSON object, not a string as when using the callGetMethod function.