# IDurableHttpClient

Package: [Microsoft.Orleans.Durable.Http](/orleans/docs/api/csharp/microsoft.orleans.durable.http/) 10.0.0-alpha.1

[Source](https://github.com/dotnet/orleans/blob/4e887e9c914a2f2647fb3c81de963511521dd9cb/src/Orleans.Durable.Http/IDurableHttpClient.cs#L27)

```csharp
public interface IDurableHttpClient
```

Sends HTTP requests and runs HTTP operations as steps of durable tasks, so retries and replays of a task reach the same server-side work.

## Remarks

Each method which returns a durable task records its responses as steps of the calling task: a replay reads the recorded response without sending the request again, and a step which a failure or a deactivation interrupts sends its request again with the same `Idempotency-Key`, which identifies the step. Requests with safe methods, such as `GET`, carry no key. Call these methods from durable executions, such as durable grain methods, in silos.

Operations follow the conventions which this package's durable operation endpoints serve, which are compatible with Azure long-running operations: a `202 Accepted` response locates the operation's status monitor with `Operation-Location`, which `POST {status monitor}:cancel` cancels and `POST {status monitor}/signals/{name}` signals. [IDurableHttpClient](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/) also waits for operations which Azure services, and servers which answer `202 Accepted` with a `Location`, run.

Register a client with `AddDurableHttpClient`, which returns the builder of its `System.Net.Http.HttpClient`, and inject it as a keyed service with the client's name.

## Methods

- [CancelOperationAsync(Uri, string?)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/canceloperationasync-system-uri-string-nullable-9fb0e00f/)
- [GetOperationAsync(Uri)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/getoperationasync-system-uri-0c009c95/)
- [SendAsync(Func&lt;HttpRequestMessage&gt;)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/sendasync-system-func-system-net-http-httprequestmessage-369b29fb/)
- [SignalOperationAsync(Uri, string, T)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/signaloperationasync-1-system-uri-string-t-139f8784/)
- [StartOperationAsync(Func&lt;HttpRequestMessage&gt;)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/startoperationasync-system-func-system-net-http-httprequestmessage-7a6758ee/)
- [WaitForOperationAsync(DurableHttpOperation, DurableHttpOperationOptions?)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/waitforoperationasync-1-orleans-durable-http-durablehttpoperation-orleans-durabl-fb1561d7/)
- [WatchOperationAsync(Uri, CancellationToken)](/orleans/docs/api/csharp/microsoft.orleans.durable.http/orleans.durable.http.idurablehttpclient/methods/watchoperationasync-system-uri-system-threading-cancellationtoken-8273908e/)
