Skip to content

ExecuteJsonAsync

Executes the request asynchronously and returns the response body as a JavaScript object.

1
myRestRequest.ExecuteJsonAsync():Promise<object>

Returns

A Promise that resolves to the response body as a JavaScript object.

Remarks

Unlike the RestRequest.Execute method, this method verifies that the server's status code is OK (HTTP 200). If not, an exception is thrown.

Example

```javascript var client = $Rest.Create('http://targetserver');

var request = client.Request();

request.AddParameter('x', 1);

request.ExecuteJsonAsync().then(function(result) { // .. });

See Also