Redigera

Dela via


HttpClientJsonExtensions.PutAsJsonAsync Method

Definition

Overloads

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
Uri

The Uri the request is sent to.

value
TValue

The value to serialize.

options
JsonSerializerOptions

Options to control the behavior during serialization. The default options are those specified by Web.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsJsonAsync(System::Net::Http::HttpClient ^ client, System::String ^ requestUri, TValue value, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
String

The Uri the request is sent to.

value
TValue

The value to serialize.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method uses JsonSerializerDefaults.Web options for serialization, whereas JsonSerializer serialization methods do not, by default.

Applies to

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsJsonAsync(System::Net::Http::HttpClient ^ client, Uri ^ requestUri, TValue value, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
Uri

The Uri the request is sent to.

value
TValue

The value to serialize.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method uses JsonSerializerDefaults.Web options for serialization, whereas JsonSerializer serialization methods do not, by default.

Applies to

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
String

The Uri the request is sent to.

value
TValue

The value to serialize.

options
JsonSerializerOptions

Options to control the behavior during serialization. The default options are those specified by Web.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
String

The Uri the request is sent to.

value
TValue

The value to serialize.

jsonTypeInfo
JsonTypeInfo<TValue>

The JsonTypeInfo used to control the serialization behavior.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)

Type Parameters

TValue

The type of the value to serialize.

Parameters

client
HttpClient

The client used to send the request.

requestUri
Uri

The Uri the request is sent to.

value
TValue

The value to serialize.

jsonTypeInfo
JsonTypeInfo<TValue>

The JsonTypeInfo used to control the serialization behavior.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

The task object representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Applies to