HttpClientExtensions.PostAsJsonAsync Method
Namespace: System.Net.Http
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Overload List
Name | Description | |
---|---|---|
PostAsJsonAsync<T>(HttpClient, String, T) | ||
PostAsJsonAsync<T>(HttpClient, String, T, CancellationToken) | ||
PostAsJsonAsync<T>(HttpClient, Uri, T) | Sends a POST request as an asynchronous operation to the specified Uri with the given value serialized as JSON. |
|
PostAsJsonAsync<T>(HttpClient, Uri, T, CancellationToken) | Sends a POST request as an asynchronous operation to the specified Uri with the given value serialized as JSON. |
See Also
HttpClientExtensions Class
System.Net.Http Namespace
Return to top
HttpClientExtensions.PostAsJsonAsync<T> Method (HttpClient, String, T)
Syntax
public static Task<HttpResponseMessage> PostAsJsonAsync<T>(
this HttpClient client,
string requestUri,
T value
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<HttpResponseMessage^>^ PostAsJsonAsync(
HttpClient^ client,
String^ requestUri,
T value
)
static member PostAsJsonAsync<'T> :
client:HttpClient *
requestUri:string *
value:'T -> Task<HttpResponseMessage>
<ExtensionAttribute>
Public Shared Function PostAsJsonAsync(Of T) (
client As HttpClient,
requestUri As String,
value As T
) As Task(Of HttpResponseMessage)
Parameters
- client
Type: System.Net.Http.HttpClient
- requestUri
Type: System.String
- value
Type: T
Return Value
Type: System.Threading.Tasks.Task<HttpResponseMessage>
Type Parameters
- T
Return to top
HttpClientExtensions.PostAsJsonAsync<T> Method (HttpClient, String, T, CancellationToken)
Syntax
public static Task<HttpResponseMessage> PostAsJsonAsync<T>(
this HttpClient client,
string requestUri,
T value,
CancellationToken cancellationToken
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<HttpResponseMessage^>^ PostAsJsonAsync(
HttpClient^ client,
String^ requestUri,
T value,
CancellationToken cancellationToken
)
static member PostAsJsonAsync<'T> :
client:HttpClient *
requestUri:string *
value:'T *
cancellationToken:CancellationToken -> Task<HttpResponseMessage>
<ExtensionAttribute>
Public Shared Function PostAsJsonAsync(Of T) (
client As HttpClient,
requestUri As String,
value As T,
cancellationToken As CancellationToken
) As Task(Of HttpResponseMessage)
Parameters
- client
Type: System.Net.Http.HttpClient
- requestUri
Type: System.String
- value
Type: T
- cancellationToken
Type: System.Threading.CancellationToken
Return Value
Type: System.Threading.Tasks.Task<HttpResponseMessage>
Type Parameters
- T
Return to top
HttpClientExtensions.PostAsJsonAsync<T> Method (HttpClient, Uri, T)
Sends a POST request as an asynchronous operation to the specified Uri with the given value serialized as JSON.
Syntax
public static Task<HttpResponseMessage> PostAsJsonAsync<T>(
this HttpClient client,
Uri requestUri,
T value
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<HttpResponseMessage^>^ PostAsJsonAsync(
HttpClient^ client,
Uri^ requestUri,
T value
)
static member PostAsJsonAsync<'T> :
client:HttpClient *
requestUri:Uri *
value:'T -> Task<HttpResponseMessage>
<ExtensionAttribute>
Public Shared Function PostAsJsonAsync(Of T) (
client As HttpClient,
requestUri As Uri,
value As T
) As Task(Of HttpResponseMessage)
Parameters
client
Type: System.Net.Http.HttpClientThe client used to make the request.
requestUri
Type: System.UriThe Uri the request is sent to.
value
Type: TThe value that will be placed in the request's entity body.
Return Value
Type: System.Threading.Tasks.Task<HttpResponseMessage>
A task object representing the asynchronous operation.
Type Parameters
- T
The type of value.
Return to top
HttpClientExtensions.PostAsJsonAsync<T> Method (HttpClient, Uri, T, CancellationToken)
Sends a POST request as an asynchronous operation to the specified Uri with the given value serialized as JSON.
Syntax
public static Task<HttpResponseMessage> PostAsJsonAsync<T>(
this HttpClient client,
Uri requestUri,
T value,
CancellationToken cancellationToken
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<HttpResponseMessage^>^ PostAsJsonAsync(
HttpClient^ client,
Uri^ requestUri,
T value,
CancellationToken cancellationToken
)
static member PostAsJsonAsync<'T> :
client:HttpClient *
requestUri:Uri *
value:'T *
cancellationToken:CancellationToken -> Task<HttpResponseMessage>
<ExtensionAttribute>
Public Shared Function PostAsJsonAsync(Of T) (
client As HttpClient,
requestUri As Uri,
value As T,
cancellationToken As CancellationToken
) As Task(Of HttpResponseMessage)
Parameters
client
Type: System.Net.Http.HttpClientThe client used to make the request.
requestUri
Type: System.UriThe Uri the request is sent to.
value
Type: TThe value that will be placed in the request's entity body.
cancellationToken
Type: System.Threading.CancellationTokenA cancellation token that can be used by other objects or threads to receive notice of cancellation.
Return Value
Type: System.Threading.Tasks.Task<HttpResponseMessage>
A task object representing the asynchronous operation.
Type Parameters
- T
The type of value.
Return to top