# IDurableHttpClient Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/)

## CancelOperationAsync(Uri, string?) {#canceloperationasync-system-uri-string-nullable-9fb0e00f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/canceloperationasync-system-uri-string-nullable-9fb0e00f/)

```csharp
public abstract DurableTask<DurableOperation> CancelOperationAsync(Uri operationLocation, string? reason = null)
```

Requests cancellation of an operation with `POST {status monitor}:cancel`, as a step of the calling task.

### Parameters

- `operationLocation` (`Uri`): The URL of the operation's status monitor.
- `reason` (`string?`): The reason which the operation's task reads, or `null` for none.

### Returns

A durable task which returns the operation's status: running while its cancellation proceeds, or terminal.

### Exceptions

- `System.Net.Http.HttpRequestException`: The response doesn't have a success status code.

## GetOperationAsync(Uri) {#getoperationasync-system-uri-0c009c95}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/getoperationasync-system-uri-0c009c95/)

```csharp
public abstract DurableTask<DurableOperation> GetOperationAsync(Uri operationLocation)
```

Reads an operation's status monitor, as a step of the calling task.

### Parameters

- `operationLocation` (`Uri`): The URL of the operation's status monitor.

### Returns

A durable task which returns the operation's status, and its result or error once it is terminal.

### Exceptions

- `System.Net.Http.HttpRequestException`: The response doesn't have a success status code.

## SendAsync(Func&lt;HttpRequestMessage&gt;) {#sendasync-system-func-system-net-http-httprequestmessage-369b29fb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/sendasync-system-func-system-net-http-httprequestmessage-369b29fb/)

```csharp
public abstract DurableTask<DurableHttpResponse> SendAsync(Func<HttpRequestMessage> createRequest)
```

Sends the request which `createRequest` creates, as a step of the calling task.

### Parameters

- `createRequest` (`Func<HttpRequestMessage>`): Creates the request; it runs for each attempt of the step.

### Returns

A durable task which returns the recorded response, whichever its status code.

## SignalOperationAsync(Uri, string, T) {#signaloperationasync-1-system-uri-string-t-139f8784}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/signaloperationasync-1-system-uri-string-t-139f8784/)

```csharp
public abstract DurableTask SignalOperationAsync<T>(Uri operationLocation, string signalName, T value)
```

Delivers a signal with a JSON value to an operation with `POST {status monitor}/signals/{name}`, as a step of the calling task.

### Parameters

- `operationLocation` (`Uri`): The URL of the operation's status monitor.
- `signalName` (`string`): The signal's name.
- `value` (`T`): The signal's value.

### Returns

A durable task which completes once the operation holds the signal.

### Exceptions

- `System.Net.Http.HttpRequestException`: The response doesn't have a success status code, such as `409 Conflict` for an operation which holds another value or completed without the signal.

## StartOperationAsync(Func&lt;HttpRequestMessage&gt;) {#startoperationasync-system-func-system-net-http-httprequestmessage-7a6758ee}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/startoperationasync-system-func-system-net-http-httprequestmessage-7a6758ee/)

```csharp
public abstract DurableTask<DurableHttpOperation> StartOperationAsync(Func<HttpRequestMessage> createRequest)
```

Sends the request which starts an operation, as a step of the calling task, and returns the operation.

### Parameters

- `createRequest` (`Func<HttpRequestMessage>`): Creates the request; it runs for each attempt of the step.

### Returns

A durable task which returns the operation, which the start response may already have completed.

### Exceptions

- `System.Net.Http.HttpRequestException`: The response reports neither an operation nor a result, or accepts the request without locating its operation.

## WaitForOperationAsync(DurableHttpOperation, DurableHttpOperationOptions?) {#waitforoperationasync-1-orleans-durable-http-durablehttpoperation-orleans-durabl-fb1561d7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/waitforoperationasync-1-orleans-durable-http-durablehttpoperation-orleans-durabl-fb1561d7/)

```csharp
public abstract DurableTask<TResult> WaitForOperationAsync<TResult>(DurableHttpOperation operation, DurableHttpOperationOptions? options = null)
```

Durably waits for an operation's result.

### Parameters

- `operation` (`DurableHttpOperation`): The operation which [IDurableHttpClient](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/) returned.
- `options` (`DurableHttpOperationOptions?`): Configures the wait, or `null` for the defaults.

### Returns

A durable task which returns the operation's result.

### Exceptions

- `Orleans.Durable.Http.DurableHttpOperationException`: The operation failed or was canceled.
- `System.Net.Http.HttpRequestException`: A response has a status code which reports neither a status nor a result.

## WatchOperationAsync(Uri, CancellationToken) {#watchoperationasync-system-uri-system-threading-cancellationtoken-8273908e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/watchoperationasync-system-uri-system-threading-cancellationtoken-8273908e/)

```csharp
public abstract IAsyncEnumerable<DurableOperation> WatchOperationAsync(Uri operationLocation, CancellationToken cancellationToken = default(CancellationToken))
```

Streams an operation's statuses from the server-sent events of `{status monitor}/events` until the operation is terminal.

### Parameters

- `operationLocation` (`Uri`): The URL of the operation's status monitor.
- `cancellationToken` (`CancellationToken`): Stops the stream.

### Returns

The operation's statuses, which end with its terminal status.

### Exceptions

- `System.Net.Http.HttpRequestException`: A response doesn't have a success status code.
