Edit in GitHubLog an issue

Code-based Experiences - API reference

This document lists the public APIs available in the Messaging extension for implementing code-based experiences.

getPropositionsForSurfaces

The getPropositionsForSurfaces API retrieves the previously fetched propositions from the SDK's in-memory propositions cache for the provided surfaces. The completion handler is invoked with the decision propositions corresponding to the given surfaces or AEPError, if it occurs.

If a requested surface was not previously cached prior to calling getPropositionsForSurfaces (using the updatePropositionsForSurfaces API), no propositions will be returned for that surface.

Java

Syntax

Copied to your clipboard
public static void getPropositionsForSurfaces(@NonNull final List<Surface> surfaces, @NonNull final AdobeCallback<Map<Surface, List<Proposition>>> callback)
  • surfaces is a list of surfaces for which propositions are requested.
  • callback call method is invoked with propositions map of type Map<Surface, List<Proposition>>. If the callback is an instance of AdobeCallbackWithError, and if the operation times out or an error occurs in retrieving propositions, the fail method is invoked with the appropriate AdobeError.

Syntax

Copied to your clipboard
final Surface surface1 = new Surface("myActivity#button");
final Surface surface2 = new Surface("myActivityAttributes");
final List<Surface> surfaces = new ArrayList<>();
surfaces.add(surface1);
surfaces.add(surface2);
Messaging.getPropositionsForSurfaces(surfaces, new AdobeCallbackWithError<Map<Surface, List<Proposition>>>() {
@Override
public void fail(final AdobeError adobeError) {
// handle error
}
@Override
public void call(Map<Surface, List<Proposition>> propositionsMap) {
if (propositionsMap != null && !propositionsMap.isEmpty()) {
// get the propositions for the given surfaces
if (propositionsMap.contains(surface1)) {
final List<Proposition> propositions1 = propositionsMap.get(surface1)
// read surface1 propositions
}
if (propositionsMap.contains(surface2)) {
final List<Proposition> proposition2 = propositionsMap.get(surface2)
// read surface2 propositions
}
}
}
});

updatePropositionsForSurfaces

The updatePropositionsForSurfaces API dispatches an event for the Edge network extension to fetch personalization decisions from the AJO campaigns for the provided surfaces array. The returned decision propositions are cached in-memory by the Messaging extension.

To retrieve previously cached decision propositions, use getPropositionsForSurfaces API.

Java

Syntax

Copied to your clipboard
public static void updatePropositionsForSurfaces(@NonNull final List<Surface> surfaces)
  • surfaces is a list of surfaces for which propositions need updating.

Syntax

Copied to your clipboard
final Surface surface1 = new Surface("myActivity#button");
final Surface surface2 = new Surface("myActivityAttributes");
final List<Surface> surfaces = new ArrayList<>();
surfaces.add(surface1);
surfaces.add(surface2);
Messaging.updatePropositionsForSurfaces(surfaces)
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.