Edit in GitHubLog an issue

Asynchronous Requests


One benefit of server-side integration is that one can leverage the huge bandwidth and computing resources available on the server-side by using parallelism. Target .NET SDK supports asynchronous requests, making it easy to integrate Target into an app's existing async workflow.

Supported Methods#

Copied to your clipboard
1Task<TargetDeliveryResponse> GetOffersAsync(TargetDeliveryRequest request);
2Task<TargetDeliveryResponse> SendNotificationsAsync(TargetDeliveryRequest request);
3Task<TargetAttributes> GetAttributesAsync(TargetDeliveryRequest request, params string[] mboxes);


A sample async SDK API usage could appear as follows:

Copied to your clipboard
1var deliveryRequest = new TargetDeliveryRequest.Builder()
2 .SetExecute(new ExecuteRequest(mboxes: new List<MboxRequest> { new MboxRequest(index: 1, name: "a1-serverside-ab") }))
3 .Build();
5var response = await this.targetClient.GetOffersAsync(deliveryRequest);
7var notificationRequest = new TargetDeliveryRequest.Builder()
8 .SetSessionId(response.Request.SessionId)
9 .SetTntId(response.Response?.Id?.TntId)
10 .SetNotifications(new List<Notification>
11 {
12 new (id: "1", type: MetricType.Display, timestamp: DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
13 mbox: new NotificationMbox("product1", "J+W1Fq18hxliDDJonTPfV0S+mzxapAO3d14M43EsM9f12A6QaqL+E3XKkRFlmq9U"),
14 tokens: new List<string> { "t0FRvoWosOqHmYL5G18QCZNWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==" })
15 })
16 .Build();
18var notificationResponse = await this.targetClient.SendNotificationsAsync(notificationRequest);

This example assumes you have initialized the SDK.

Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.