Skip to content

PostAsync

Performs the request asynchronously using the POST method.

1
myRestRequest.PostAsync():Promise<RestResponse>

Returns

A Promise that resolves to a RestResponse instance containing the server's response.

Remarks

This method expects the response status code to be OK (200), Accepted (202), or No Content (204), unless RestRequest.Expect is used.

Examples

Send a notification without waiting for the reply

1
2
3
4
5
6
$Rest.Create('https://hooks.example.com/')
    .Request('orders', { orderNumber : $Xml.Evaluate('OrderNumber'), status : 'Approved' })
    .PostAsync()
    .then(function (response) {
        console.log('Notification sent: ' + response.StatusCode);
    });

See Also