Skip to content

GetAsync

Performs the request asynchronously using the GET method.

1
myRestRequest.GetAsync():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) or No Content (204), unless RestRequest.Expect is used.

Examples

Read a resource without blocking other requests

1
2
3
4
5
6
7
8
$Rest.Create('https://api.example.com/')
    .Request('customers/{id}')
    .AddUrlParameter('id', $Xml.Evaluate('CustomerId'))
    .GetAsync()
    .then(function (response) {
        var customer = response.ToJson();
        $Xml.SetValue('CustomerName', customer['name']);
    });

See Also