HttpClientJsonExtensions.PostAsJsonAsync Método

Definição

Sobrecargas

Name Description
PostAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST 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 ^> ^ PostAsJsonAsync(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> PostAsJsonAsync<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> PostAsJsonAsync<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> PostAsJsonAsync<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 PostAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PostAsJsonAsync : 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 PostAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PostAsJsonAsync(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

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST 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 ^> ^ PostAsJsonAsync(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> PostAsJsonAsync<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> PostAsJsonAsync<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> PostAsJsonAsync<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 PostAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PostAsJsonAsync : 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 PostAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PostAsJsonAsync(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

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST 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> PostAsJsonAsync<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> PostAsJsonAsync<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> PostAsJsonAsync<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 PostAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PostAsJsonAsync : 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 PostAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PostAsJsonAsync(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

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<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 PostAsJsonAsync : 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 PostAsJsonAsync(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

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST 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> PostAsJsonAsync<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> PostAsJsonAsync<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> PostAsJsonAsync<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 PostAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
static member PostAsJsonAsync : 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 PostAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PostAsJsonAsync(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

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

Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs
Origem:
HttpClientJsonExtensions.Post.cs

Envia um pedido POST para o Uri especificado contendo o value JSON serializado no corpo do pedido.

public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<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 PostAsJsonAsync : 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 PostAsJsonAsync(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.

Aplica-se a