IDownstreamApi.PostForAppAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
PostForAppAsync<TInput,TOutput>(String, TInput, Action<DownstreamApiOptionsReadOnlyHttpMethod>, CancellationToken) |
Calls, using Post, a downstream API with some input data and returning data.
By default the input data is serialized in JSON and the returned data is deserialized from JSON but you can provide your own serializer and your own deserializer in the action
you pass-in through the |
PostForAppAsync<TInput>(String, TInput, Action<DownstreamApiOptionsReadOnlyHttpMethod>, CancellationToken) |
Calls, using Post, a downstream API with some input data .
By default the input data is serialized in JSON but you can provide your own serializer in the action
you pass-in through the |
PostForAppAsync<TInput,TOutput>(String, TInput, Action<DownstreamApiOptionsReadOnlyHttpMethod>, CancellationToken)
Calls, using Post, a downstream API with some input data and returning data.
By default the input data is serialized in JSON and the returned data is deserialized from JSON but you can provide your own serializer and your own deserializer in the action
you pass-in through the downstreamApiOptionsOverride
parameter.
public System.Threading.Tasks.Task<TOutput?> PostForAppAsync<TInput,TOutput> (string? serviceName, TInput input, Action<Microsoft.Identity.Abstractions.DownstreamApiOptionsReadOnlyHttpMethod>? downstreamApiOptionsOverride = default, System.Threading.CancellationToken cancellationToken = default) where TOutput : class;
abstract member PostForAppAsync : string * 'Input * Action<Microsoft.Identity.Abstractions.DownstreamApiOptionsReadOnlyHttpMethod> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Output (requires 'Output : null)> (requires 'Output : null)
Public Function PostForAppAsync(Of TInput, TOutput) (serviceName As String, input As TInput, Optional downstreamApiOptionsOverride As Action(Of DownstreamApiOptionsReadOnlyHttpMethod) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TOutput)
Type Parameters
- TInput
Generic input type.
- TOutput
Generic output type.
Parameters
- serviceName
- String
Name of the service describing the downstream API. There can
be several configuration named sections mapped to a DownstreamApiOptions,
each for one downstream API. You can pass-in null, but in that case downstreamApiOptionsOverride
needs to be set.
- input
- TInput
Data sent to the downstream web API, through the body or the HTTP request.
- downstreamApiOptionsOverride
- Action<DownstreamApiOptionsReadOnlyHttpMethod>
[Optional] Overrides the options proposed in the configuration described
by serviceName
.
- cancellationToken
- CancellationToken
Returns
The value returned by the downstream web API.
Examples
var result = await _downstreamApi.PostForAppAsync<MyItem, IEnumerable<MyItem>>(
"MyService",
myItem,
options =>
{
options.RelativePath = $"api/todolist/{myItem.Id}";
});
Applies to
PostForAppAsync<TInput>(String, TInput, Action<DownstreamApiOptionsReadOnlyHttpMethod>, CancellationToken)
Calls, using Post, a downstream API with some input data .
By default the input data is serialized in JSON but you can provide your own serializer in the action
you pass-in through the downstreamApiOptionsOverride
parameter.
public System.Threading.Tasks.Task PostForAppAsync<TInput> (string? serviceName, TInput input, Action<Microsoft.Identity.Abstractions.DownstreamApiOptionsReadOnlyHttpMethod>? downstreamApiOptionsOverride = default, System.Threading.CancellationToken cancellationToken = default);
abstract member PostForAppAsync : string * 'Input * Action<Microsoft.Identity.Abstractions.DownstreamApiOptionsReadOnlyHttpMethod> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function PostForAppAsync(Of TInput) (serviceName As String, input As TInput, Optional downstreamApiOptionsOverride As Action(Of DownstreamApiOptionsReadOnlyHttpMethod) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task
Type Parameters
- TInput
Generic input type.
Parameters
- serviceName
- String
Name of the service describing the downstream API. There can
be several configuration named sections mapped to a DownstreamApiOptions,
each for one downstream API. You can pass-in null, but in that case downstreamApiOptionsOverride
needs to be set.
- input
- TInput
Data sent to the downstream web API, through the body or the HTTP request.
- downstreamApiOptionsOverride
- Action<DownstreamApiOptionsReadOnlyHttpMethod>
[Optional] Overrides the options proposed in the configuration described
by serviceName
.
- cancellationToken
- CancellationToken
Returns
The value returned by the downstream web API.
Examples
await _downstreamApi.PostForAppAsync<MyItem>(
"MyService",
myItem,
options =>
{
options.RelativePath = $"api/todolist/{myItem.Id}";
});
Applies to
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示