HttpClientJsonExtensions.PutAsJsonAsync Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Sobrecargas
| Name | Description |
|---|---|
| PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
| PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
| PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
| PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
| PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
| PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Envie um pedido PUT para o Uri especificado contendo o |
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- Uri
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- options
- JsonSerializerOptions
Opções para controlar o comportamento durante a serialização. As opções padrão são as especificadas por Web.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
- Atributos
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.
Aplica-se a
PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
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);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- String
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
- Atributos
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.
Observações
Este método utiliza JsonSerializerDefaults.Web opções para serialização, enquanto JsonSerializer métodos de serialização não, por defeito.
Aplica-se a
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
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);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- Uri
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
- Atributos
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.
Observações
Este método utiliza JsonSerializerDefaults.Web opções para serialização, enquanto JsonSerializer métodos de serialização não, por defeito.
Aplica-se a
PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- String
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- options
- JsonSerializerOptions
Opções para controlar o comportamento durante a serialização. As opções padrão são as especificadas por Web.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
- Atributos
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.
Aplica-se a
PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- String
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- jsonTypeInfo
- JsonTypeInfo<TValue>
O JsonTypeInfo era usado para controlar o comportamento de serialização.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.
Aplica-se a
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken)
Envie um pedido PUT para o Uri especificado contendo o value JSON serializado no corpo do pedido.
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)
Parâmetros de Tipo Genérico
- TValue
O tipo do valor a serializar.
Parâmetros
- client
- HttpClient
O cliente costumava enviar o pedido.
- requestUri
- Uri
O Uri para onde o pedido é enviado.
- value
- TValue
O valor de serializar.
- jsonTypeInfo
- JsonTypeInfo<TValue>
O JsonTypeInfo era usado para controlar o comportamento de serialização.
- cancellationToken
- CancellationToken
Um token de cancelamento que pode ser usado por outros objetos ou threads para receber aviso de cancelamento.
Devoluções
O objeto tarefa que representa a operação assíncrona.
Exceções
O token de cancelamento foi cancelado. Esta exceção é armazenada na tarefa devolvida.