HttpClientJsonExtensions.PostAsJsonAsync Metoda

Definice

Přetížení

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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)

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
String

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Atributy

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Poznámky

Tato metoda používá JsonSerializerDefaults.Web možnosti pro serializaci, zatímco JsonSerializer metody serializace ve výchozím nastavení ne.

Platí pro

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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)

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
Uri

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Atributy

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Poznámky

Tato metoda používá JsonSerializerDefaults.Web možnosti pro serializaci, zatímco JsonSerializer metody serializace ve výchozím nastavení ne.

Platí pro

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
String

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

options
JsonSerializerOptions

Možnosti řízení chování během serializace Výchozí možnosti jsou určené parametrem Web.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Atributy

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Platí pro

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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)

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
String

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

jsonTypeInfo
JsonTypeInfo<TValue>

JsonTypeInfo sloužící k řízení chování serializace.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Platí pro

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
Uri

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

options
JsonSerializerOptions

Možnosti řízení chování během serializace Výchozí možnosti jsou určené parametrem Web.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Atributy

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Platí pro

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

Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs
Zdroj:
HttpClientJsonExtensions.Post.cs

Odešle požadavek POST na zadaný identifikátor URI obsahující value serializovaný jako JSON v textu požadavku.

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)

Parametry typu

TValue

Typ hodnoty, která se má serializovat.

Parametry

client
HttpClient

Klient použitý k odeslání požadavku.

requestUri
Uri

Identifikátor URI, na který se požadavek odešle.

value
TValue

Hodnota k serializaci.

jsonTypeInfo
JsonTypeInfo<TValue>

JsonTypeInfo sloužící k řízení chování serializace.

cancellationToken
CancellationToken

Token zrušení, který lze použít jinými objekty nebo vlákny k přijetí oznámení o zrušení.

Návraty

Objekt úkolu představující asynchronní operaci.

Výjimky

Token zrušení byl zrušen. Tato výjimka je uložena do vrácené úlohy.

Platí pro