Edit in GitHubLog an issue

Edge Network API reference

extensionVersion

Returns the version of the client-side Edge extension.

Java

Syntax

Copied to your clipboard
public static String extensionVersion();

Example

Copied to your clipboard
String extensionVersion = Edge.extensionVersion();

Kotlin

Example

Copied to your clipboard
val extensionVersion = EdgeBridge.extensionVersion()

getLocationHint

Gets the Edge Network location hint used in requests to the Adobe Experience Platform Edge Network. The Edge Network location hint may be used when building the URL for Adobe Experience Platform Edge Network requests to hint at the server cluster to use.

Java

Syntax

Copied to your clipboard
public static void getLocationHint(final AdobeCallback<String> callback)
  • callback is invoked with the location hint. The location hint value may be null if the location hint expired or was not set. The callback may be invoked on a different thread. If AdobeCallbackWithError is provided, the default timeout is 1000ms and the fail method is called if the operation times out or an unexpected error occurs.

Example

Copied to your clipboard
Edge.getLocationHint(new AdobeCallbackWithError<String>() {
@Override
public void call(final String hint) {
// Handle the hint here
}
@Override
public void fail(AdobeError adobeError) {
// Handle the error here
}
});

Kotlin

Example

Copied to your clipboard
Edge.getLocationHint(object: AdobeCallbackWithError<String> {
override fun call(hint: String) {
// Handle the hint here
}
override fun fail(error: AdobeError?) {
// Handle the error here
}
})

registerExtension

Java

Syntax

Copied to your clipboard
public static void registerExtension();

Example

Copied to your clipboard
Edge.registerExtension();

resetIdentities

Resets current state of the AEP Edge extension and clears previously cached content related to current identity, if any.

See MobileCore.resetIdentities for more details.

sendEvent

Sends an Experience event to Adobe Experience Platform Edge Network.

The process involves two steps:

  1. Define your Datastream configuration overrides on the datastream configuration page.
  2. Send these overrides to the Edge Network using the sendEvent API.

Java

Syntax

Copied to your clipboard
public static void sendEvent(final ExperienceEvent experienceEvent,
final EdgeCallback callback);
  • experienceEvent - the XDM Experience Event to be sent to Adobe Experience Platform Edge Network
  • completion - optional callback to be invoked when the request is complete, returning the associated EdgeEventHandle(s) received from the Adobe Experience Platform Edge Network. It may be invoked on a different thread.

Example

Copied to your clipboard
// Create Experience Event from map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build();
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
Edge.sendEvent(experienceEvent, null);
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});
Example with Datastream ID override
Copied to your clipboard
// Create experience event from Map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamIdOverride("SampleDatastreamId")
.build();
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});
Example with Datastream config override
Copied to your clipboard
// ----------------- Datastream config overrides map start -----------------
Map<String, Object> configOverrides = new HashMap<>();
// com_adobe_experience_platform
Map<String, Object> experiencePlatform = new HashMap<>();
Map<String, Object> datasets = new HashMap<>();
Map<String, Object> eventDataset = new HashMap<>();
eventDataset.put("datasetId", "SampleEventDatasetIdOverride");
datasets.put("event", eventDataset);
experiencePlatform.put("datasets", datasets);
configOverrides.put("com_adobe_experience_platform", experiencePlatform);
// com_adobe_analytics
Map<String, Object> analytics = new HashMap<>();
analytics.put("reportSuites", new String[]{"rsid1", "rsid2", "rsid3"});
configOverrides.put("com_adobe_analytics", analytics);
// com_adobe_identity
Map<String, Object> identity = new HashMap<>();
identity.put("idSyncContainerId", "1234567");
configOverrides.put("com_adobe_identity", identity);
// com_adobe_target
Map<String, Object> target = new HashMap<>();
target.put("propertyToken", "SamplePropertyToken");
configOverrides.put("com_adobe_target", target);
// ----------------- Datastream config overrides map end -----------------
// Create experience event from Map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamConfigOverride(configOverrides)
.build();
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});

Kotlin

Example

Copied to your clipboard
// Create Experience Event from map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build()
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
Edge.sendEvent(experienceEvent, null)
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}
Example with Datastream ID override
Copied to your clipboard
// Create experience event from Map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamIdOverride("SampleDatastreamId")
.build()
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}
Example with Datastream config override
Copied to your clipboard
// Create experience event from Map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val configOverrides = mapOf(
"com_adobe_experience_platform" to mapOf(
"datasets" to mapOf(
"event" to mapOf("datasetId" to "SampleEventDatasetIdOverride")
)
),
"com_adobe_analytics" to mapOf(
"reportSuites" to listOf("rsid1", "rsid2", "rsid3")
),
"com_adobe_identity" to mapOf(
"idSyncContainerId" to "1234567"
),
"com_adobe_target" to mapOf(
"propertyToken" to "SamplePropertyToken"
)
)
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamConfigOverride(configOverrides)
.build()
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}

setLocationHint

Sets the Edge Network location hint used in requests to the Adobe Experience Platform Edge Network. Passing nil or an empty string clears the existing location hint. Edge Network responses may overwrite the location hint to a new value when necessary to manage network traffic.

Java

Syntax

Copied to your clipboard
public static void setLocationHint(final String hint)
  • hint the Edge Network location hint to use when connecting to the Adobe Experience Platform Edge Network.

Example

Copied to your clipboard
Edge.setLocationHint(hint);

Kotlin

Example

Copied to your clipboard
Edge.setLocationHint(hint)

Public classes

XDM Schema

The AEP Edge extension provides the Schema and Property interfaces (Android) / XDMSchema protocol (iOS) that can be used to define the classes associated with your XDM schema in Adobe Experience Platform.

Java

Copied to your clipboard
/**
* The interface that represents an Experience XDM event data schema.
*/
public interface Schema {
/**
* Returns the version of this schema as defined in the Adobe Experience Platform.
* @return the version of this schema.
*/
String getSchemaVersion();
/**
* Returns the identifier for this schema as defined in the Adobe Experience Platform.
* The identifier is a URI where this schema is defined.
* @return the URI identifier for this schema.
*/
String getSchemaIdentifier();
/**
* Returns the identifier for this dataset as defined in the Adobe Experience Platform.
* @return the dataset ID
*/
String getDatasetIdentifier();
/**
* Serialize this {@code Schema} object to a map with the same format as its XDM schema.
* @return the XDM-formatted map of this {@code Schema} object.
*/
Map<String, Object> serializeToXdm();
}

By implementing the Property interface, you can define complex properties for your XDM Schema. A complex property is defined as not being a primitive type, String, or Date.

Copied to your clipboard
public interface Property {
/**
* Serialize this {@code Property} object to a map with the same format as its XDM schema.
* @return XDM-formatted map of this {@code Property} object.
*/
Map<String, Object> serializeToXdm();
}

When defining your custom XDM schema(s), implement these interfaces to ensure that the AEP Edge extension successfully serializes the provided data before sending it to Adobe Experience Platform Edge Network.

EdgeEventHandle

The EdgeEventHandle is a response fragment from Adobe Experience Platform Edge Network for a sent XDM Experience Event. One event can receive none, one or multiple EdgeEventHandle(s) as response.

Java

Copied to your clipboard
/**
* The {@link EdgeEventHandle} is a response fragment from Adobe Experience Edge Service for a sent XDM Experience Event.
* One event can receive none, one or multiple {@link EdgeEventHandle}(s) as response.
*/
public class EdgeEventHandle {
/**
* @return the payload type or null if not found in the {@link JSONObject} response
*/
public String getType() {...}
/**
* @return the event payload values for this {@link EdgeEventHandle} or null if not found in the {@link JSONObject} response
*/
public List<Map<String, Object>> getPayload() {...}
}

Use this class when calling the sendEvent API with EdgeCallback.

ExperienceEvent

Experience Event is the event to be sent to Adobe Experience Platform Edge Network. The XDM data is required for any Experience Event being sent using the Edge extension.

Java

Copied to your clipboard
public final class ExperienceEvent {
public static class Builder {
...
public Builder() {
...
}
/**
* Sets free form data associated with this event to be passed to Adobe Experience Edge.
*
* @param data free form data, JSON like types are accepted
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setData(final Map<String, Object> data) {...}
/**
* Solution specific XDM event data for this event.
*
* @param xdm {@link Schema} information
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Schema xdm) {...}
/**
* Solution specific XDM event data and dataset identifier for this event.
*
* @param xdm {@code Map<String, Object>} of raw XDM schema data
* @param datasetIdentifier The Experience Platform dataset identifier where this event is sent.
* If not provided, the default dataset defined in the configuration ID is used
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Map<String, Object> xdm, final String datasetIdentifier) {...}
/**
* Solution specific XDM event data for this event, passed as raw mapping of keys and
* Object values.
*
* @param xdm {@code Map<String, Object>} of raw XDM schema data
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Map<String, Object> xdm) {...}
/**
* Override the default datastream identifier to send this event's data to a different datastream.
*
* When using {@link Edge#sendEvent}, this event is sent to the Experience Platform using the
* datastream identifier {@code datastreamIdOverride} instead of the default Experience Edge
* configuration ID set in the SDK Configuration key {@code edge.configId}.
*
* @param datastreamIdOverride Datastream identifier to override the default datastream identifier set in the Edge configuration
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*
*/
public Builder setDatastreamIdOverride(final String datastreamIdOverride) {...}
/**
* Override the default datastream configuration settings for individual services for this event.
*
* When using {@link Edge#sendEvent}, this event is sent to the Experience Platform along with the
* datastream overrides defined in {@code datastreamConfigOverride}.
*
* @param datastreamConfigOverride Map defining datastream configuration overrides for this Experience Event
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setDatastreamConfigOverride(final Map<String, Object> datastreamConfigOverride) {...}
/**
* Builds and returns a new instance of {@code ExperienceEvent}.
*
* @return a new instance of {@code ExperienceEvent} or null if one of the required parameters is missing
* @throws UnsupportedOperationException if this instance was already built
*/
public ExperienceEvent build() {...}
}
public Map<String, Object> getData() {...}
public Map<String, Object> getXdmSchema() {...}
public String getDatastreamIdOverride() {...}
public Map<String, Object> getDatastreamConfigOverride() {...}
}

Examples

Copied to your clipboard
// Example 1
// Create Experience Event with both XDM and freeform data using maps
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
Map<String, Object> data = new HashMap<>();
data.put("free", "form");
data.put("data", "example");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setData(data)
.build();
Copied to your clipboard
// Example 2
// Create Experience Event from XDM Schema implementation
public class XDMSchemaExample implements com.adobe.marketing.mobile.xdm.Schema {
private String eventType;
private String otherField;
...
public String getEventType() {
return this.eventType;
}
public void setEventType(final String newValue) {
this.eventType = newValue;
}
public String getOtherField() {
return this.otherField;
}
public void setOtherField(final String newValue) {
this.otherField = newValue;
}
}
// Create Experience Event from Schema
XDMSchemaExample xdmData = new XDMSchemaExample();
xdmData.setEventType("SampleXDMEvent");
xdmData.setOtherField("OtherFieldValue");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build();
Copied to your clipboard
// Example 3
// Set the destination Dataset identifier to the current Experience Event
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData, "datasetIdExample")
.build();

See Edge Extension Usage for more examples.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.