HttpClientJsonExtensions.PostAsJsonAsync Metodo

Definizione

Overload

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
String

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Attributi

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo usa le JsonSerializerDefaults.Web opzioni per la serializzazione, mentre JsonSerializer i metodi di serializzazione non lo fanno per impostazione predefinita.

Si applica a

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
Uri

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Attributi

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Commenti

Questo metodo usa le JsonSerializerDefaults.Web opzioni per la serializzazione, mentre JsonSerializer i metodi di serializzazione non lo fanno per impostazione predefinita.

Si applica a

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

[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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
String

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

options
JsonSerializerOptions

Opzioni per controllare il comportamento durante la serializzazione. Le opzioni predefinite sono quelle specificate da Web.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Attributi

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
String

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

jsonTypeInfo
JsonTypeInfo<TValue>

JsonTypeInfo usato per controllare il comportamento di serializzazione.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

[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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
Uri

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

options
JsonSerializerOptions

Opzioni per controllare il comportamento durante la serializzazione. Le opzioni predefinite sono quelle specificate da Web.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Attributi

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a

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

Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs
Origine:
HttpClientJsonExtensions.Post.cs

Invia una richiesta POST all'URI specificato contenente il value serializzato come JSON nel corpo della richiesta.

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)

Parametri di tipo

TValue

Tipo del valore da serializzare.

Parametri

client
HttpClient

Client utilizzato per inviare la richiesta.

requestUri
Uri

URI a cui viene inviata la richiesta.

value
TValue

Valore da serializzare.

jsonTypeInfo
JsonTypeInfo<TValue>

JsonTypeInfo usato per controllare il comportamento di serializzazione.

cancellationToken
CancellationToken

Token di annullamento che può essere utilizzato da altri oggetti o thread per ricevere un avviso di annullamento.

Valori restituiti

Oggetto attività che rappresenta l'operazione asincrona.

Eccezioni

Il token di annullamento è stato annullato. Questa eccezione viene archiviata nell'attività restituita.

Si applica a