Edge Network API reference

extensionVersion

Returns the version of the client-side Edge extension.
Android
iOS (AEP 3.x)

Java

Syntax
1
public static String extensionVersion();
Copied!
Example
1
String extensionVersion = Edge.extensionVersion();
Copied!

Swift

Syntax
1
static let extensionVersion
Copied!
Example
1
let extensionVersion = Edge.extensionVersion
Copied!

Objective-C

Syntax
1
+ (nonnull NSString*) extensionVersion;
Copied!
Example
1
NSString *extensionVersion = [AEPMobileEdge extensionVersion];
Copied!

sendEvent

Sends an Experience event to Adobe Experience Platform Edge Network.
Android
iOS (AEP 3.x)

Java

Syntax
1
public static void sendEvent(final ExperienceEvent experienceEvent, final EdgeCallback callback);
Copied!
  • 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
1
// create experience event from Map
2
Map<String, Object> xdmData = new HashMap<>();
3
xdmData.put("eventType", "SampleXDMEvent");
4
xdmData.put("sample", "data");
5
6
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
7
.setXdmSchema(xdmData)
8
.build();
Copied!
1
// example 1 - send the experience event without handling the Edge Network response
2
Edge.sendEvent(experienceEvent, null);
Copied!
1
// example 2 - send the experience event and handle the Edge Network response onComplete
2
Edge.sendEvent(experienceEvent, new EdgeCallback() {
3
@Override
4
public void onComplete(final List<EdgeEventHandle> handles) {
5
// handle the Edge Network response
6
}
7
});
Copied!

Swift

Syntax
1
static func sendEvent(experienceEvent: ExperienceEvent, _ completion: (([EdgeEventHandle]) -> Void)? = nil)
Copied!
  • 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
1
//create experience event from dictionary:
2
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
3
"sample": "data"]
4
let experienceEvent = ExperienceEvent(xdm: xdmData)
Copied!
1
// example 1 - send the experience event without handling the Edge Network response
2
Edge.sendEvent(experienceEvent: experienceEvent)
Copied!
1
// example 2 - send the experience event and handle the Edge Network response onComplete
2
Edge.sendEvent(experienceEvent: experienceEvent) { (handles: [EdgeEventHandle]) in
3
// handle the Edge Network response
4
}
Copied!

Objective-C

Syntax
1
+ (void) sendExperienceEvent:(AEPExperienceEvent * _Nonnull) completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull)completion
Copied!
Example
1
//create experience event from dictionary:
2
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
3
NSDictionary *data = @{ @"sample" : @"data"};
Copied!
1
// example 1 - send the experience event without handling the Edge Network response
2
[AEPMobileEdge sendExperienceEvent:event completion:nil];
Copied!
1
// example 2 - send the experience event and handle the Edge Network response onComplete
2
[AEPMobileEdge sendExperienceEvent:event completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull handles) {
3
// handle the Edge Network response
4
}];
Copied!

registerExtension

Registers the Edge extension with the Mobile Core SDK.
Android
iOS (AEP 3.x)

Java

Syntax
1
public static void registerExtension();
Copied!
Example
1
Edge.registerExtension();
Copied!

Swift

Use the MobileCore API to register the Edge extension.
Syntax
1
// MobileCore
2
public static func registerExtensions(_ extensions: [Extension.Type], _ completion: (() -> Void)? = nil)
Copied!
Example
1
import AEPEdge
2
3
...
4
MobileCore.registerExtensions([Edge.self, ...], {
5
// processing after registration
6
})
Copied!

Objective-C

Use the AEPMobileCore API to register the Edge extension.
Syntax
1
+ (void) registerExtensions: (NSArray<Class*>* _Nonnull) extensions
2
completion: (void (^ _Nullable)(void)) completion;
Copied!
Example
1
@import AEPEdge;
2
3
[AEPMobileCore registerExtensions:@[AEPMobileEdge.class] completion:nil];...
Copied!

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.

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.
Android
iOS (AEP 3.x)

Java

1
/**
2
* The interface that represents an Experience XDM event data schema.
3
*/
4
public interface Schema {
5
6
/**
7
* Returns the version of this schema as defined in the Adobe Experience Platform.
8
* @return the version of this schema.
9
*/
10
String getSchemaVersion();
11
12
/**
13
* Returns the identifier for this schema as defined in the Adobe Experience Platform.
14
* The identifier is a URI where this schema is defined.
15
* @return the URI identifier for this schema.
16
*/
17
String getSchemaIdentifier();
18
19
/**
20
* Returns the identifier for this dataset as defined in the Adobe Experience Platform.
21
* @return the dataset ID
22
*/
23
String getDatasetIdentifier();
24
25
/**
26
* Serialize this {@code Schema} object to a map with the same format as its XDM schema.
27
* @return the XDM-formatted map of this {@code Schema} object.
28
*/
29
Map<String, Object> serializeToXdm();
30
}
Copied!
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.
1
public interface Property {
2
3
/**
4
* Serialize this {@code Property} object to a map with the same format as its XDM schema.
5
* @return XDM-formatted map of this {@code Property} object.
6
*/
7
Map<String, Object> serializeToXdm();
8
}
Copied!
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.

Swift

1
/// An interface representing a Platform XDM Event Data schema.
2
public protocol XDMSchema: Encodable {
3
4
/// Returns the version of this schema as defined in the Adobe Experience Platform.
5
/// - Returns: The version of this schema
6
var schemaVersion: String { get }
7
8
/// Returns the identifier for this schema as defined in the Adobe Experience Platform.
9
/// The identifier is a URI where this schema is defined.
10
/// - Returns: The URI identifier for this schema
11
var schemaIdentifier: String { get }
12
13
/// Returns the identifier for this dataset as defined in the Adobe Experience Platform.
14
/// This is a system generated identifier for the Dataset the event belongs to.
15
/// - Returns: The identifier as a String for this dataset
16
var datasetIdentifier: String { get }
17
}
Copied!

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.
Android
iOS (AEP 3.x)

Java

1
/**
2
* The {@link EdgeEventHandle} is a response fragment from Adobe Experience Edge Service for a sent XDM Experience Event.
3
* One event can receive none, one or multiple {@link EdgeEventHandle}(s) as response.
4
*/
5
public class EdgeEventHandle {
6
/**
7
* @return the payload type or null if not found in the {@link JSONObject} response
8
*/
9
public String getType() {...}
10
11
/**
12
* @return the event payload values for this {@link EdgeEventHandle} or null if not found in the {@link JSONObject} response
13
*/
14
public List<Map<String, Object>> getPayload() {...}
15
}
Copied!

Swift

1
@objc(AEPEdgeEventHandle)
2
public class EdgeEventHandle: NSObject, Codable {
3
/// Payload type
4
@objc public let type: String?
5
6
/// Event payload values
7
@objc public let payload: [[String: Any]]?
8
}
Copied!
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.
Android
iOS (AEP 3.x)

Java

1
public final class ExperienceEvent {
2
3
public static class Builder {
4
...
5
6
public Builder() {
7
...
8
}
9
10
/**
11
* Sets free form data associated with this event to be passed to Adobe Experience Edge.
12
*
13
* @param data free form data, JSON like types are accepted
14
* @return instance of current builder
15
* @throws UnsupportedOperationException if this instance was already built
16
*/
17
public Builder setData(final Map<String, Object> data) {...}
18
19
/**
20
* Solution specific XDM event data for this event.
21
*
22
* @param xdm {@link Schema} information
23
* @return instance of current builder
24
* @throws UnsupportedOperationException if this instance was already built
25
*/
26
public Builder setXdmSchema(final Schema xdm) {...}
27
28
/**
29
* Solution specific XDM event data and dataset identifier for this event.
30
*
31
* @param xdm {@code Map<String, Object>} of raw XDM schema data
32
* @param datasetIdentifier The Experience Platform dataset identifier where this event is sent.
33
* If not provided, the default dataset defined in the configuration ID is used
34
* @return instance of current builder
35
* @throws UnsupportedOperationException if this instance was already built
36
*/
37
public Builder setXdmSchema(final Map<String, Object> xdm, final String datasetIdentifier) {...}
38
39
/**
40
* Solution specific XDM event data for this event, passed as raw mapping of keys and
41
* Object values.
42
*
43
* @param xdm {@code Map<String, Object>} of raw XDM schema data
44
* @return instance of current builder
45
* @throws UnsupportedOperationException if this instance was already built
46
*/
47
public Builder setXdmSchema(final Map<String, Object> xdm) {...}
48
49
/**
50
* Builds and returns a new instance of {@code ExperienceEvent}.
51
*
52
* @return a new instance of {@code ExperienceEvent} or null if one of the required parameters is missing
53
* @throws UnsupportedOperationException if this instance was already built
54
*/
55
public ExperienceEvent build() {...}
56
}
57
58
public Map<String, Object> getData() {...}
59
60
public Map<String, Object> getXdmSchema() {...}
61
}
Copied!
Examples
1
//Example 1
2
// set freeform data to the Experience event
3
Map<String, Object> xdmData = new HashMap<>();
4
xdmData.put("eventType", "SampleXDMEvent");
5
xdmData.put("sample", "data");
6
7
Map<String, Object> data = new HashMap<>();
8
data.put("free", "form");
9
data.put("data", "example");
10
11
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
12
.setXdmSchema(xdmData)
13
.setData(data)
14
.build();
Copied!
1
//Example 2
2
// Create Experience Event from XDM Schema implementations
3
public class XDMSchemaExample implements com.adobe.marketing.mobile.xdm.Schema {
4
private String eventType;
5
private String otherField;
6
...
7
8
public String getEventType() {
9
return this.eventType;
10
}
11
12
public void setEventType(final String newValue) {
13
this.eventType = newValue;
14
}
15
16
public String getOtherField() {
17
return this.otherField;
18
}
19
20
public void setOtherField(final String newValue) {
21
this.otherField = newValue;
22
}
23
}
24
25
// Create Experience Event from Schema
26
XDMSchemaExample xdmData = new XDMSchemaExample();
27
xdmData.setEventType("SampleXDMEvent");
28
xdmData.setOtherField("OtherFieldValue");
29
30
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
31
.setXdmSchema(xdmData)
32
.build();
Copied!
1
//Example 3
2
// Set the destination Dataset identifier to the current Experience event:
3
Map<String, Object> xdmData = new HashMap<>();
4
xdmData.put("eventType", "SampleXDMEvent");
5
xdmData.put("sample", "data");
6
7
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
8
.setXdmSchema(xdmData, "datasetIdExample")
9
.build();
Copied!
1
@objc(AEPExperienceEvent)
2
public class ExperienceEvent: NSObject {
3
4
/// XDM formatted data, use an `XDMSchema` implementation for a better XDM data injection and format control
5
@objc public let xdm: [String: Any]?
6
7
/// Optional free-form data associated with this event
8
@objc public let data: [String: Any]?
9
10
/// Adobe Experience Platform dataset identifier, if not set the default dataset identifier set in the Edge Configuration is used
11
@objc public let datasetIdentifier: String?
12
13
/// Initialize an Experience Event with the provided event data
14
/// - Parameters:
15
/// - xdm: XDM formatted data for this event, passed as a raw XDM Schema data dictionary.
16
/// - data: Any free form data in a [String : Any] dictionary structure.
17
/// - datasetIdentifier: The Experience Platform dataset identifier where this event should be sent to; if not provided, the default dataset identifier set in the Edge configuration is used
18
@objc public init(xdm: [String: Any], data: [String: Any]? = nil, datasetIdentifier: String? = nil) {...}
19
20
/// Initialize an Experience Event with the provided event data
21
/// - Parameters:
22
/// - xdm: XDM formatted event data passed as an XDMSchema
23
/// - data: Any free form data in a [String : Any] dictionary structure.
24
public init(xdm: XDMSchema, data: [String: Any]? = nil) {...}
25
}
Copied!

Swift

Examples
1
//Example 1
2
// set freeform data to the Experience event
3
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
4
"sample": "data"]
5
6
let experienceEvent = ExperienceEvent(xdm: xdmData, data: ["free": "form", "data": "example"])
Copied!
1
//Example 2
2
// Create Experience Event from XDM Schema implementations
3
import AEPEdge
4
5
public struct XDMSchemaExample : XDMSchema {
6
public let schemaVersion = "1.0" // Returns the version of this schema as defined in the Adobe Experience Platform.
7
public let schemaIdentifier = "" // The URI identifier for this schema
8
public let datasetIdentifier = "" // The identifier for the Dataset this event belongs to.
9
10
public init() {}
11
12
public var eventType: String?
13
public var otherField: String?
14
15
enum CodingKeys: String, CodingKey {
16
case eventType = "eventType"
17
case otherField = "otherField"
18
}
19
}
20
21
extension XDMSchemaExample {
22
public func encode(to encoder: Encoder) throws {
23
var container = encoder.container(keyedBy: CodingKeys.self)
24
if let unwrapped = eventType { try container.encode(unwrapped, forKey: .eventType) }
25
if let unwrapped = otherField { try container.encode(unwrapped, forKey: .otherField) }
26
}
27
}
28
29
...
30
31
// Create Experience Event from XDMSchema
32
var xdmData = XDMSchemaExample()
33
xdmData.eventType = "SampleXDMEvent"
34
xdm.otherField = "OtherFieldValue"
35
let event = ExperienceEvent(xdm: xdmData)
Copied!
1
//Example 3
2
// Set the destination Dataset identifier to the current Experience event:
3
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
4
"sample": "data"]
5
6
let experienceEvent = ExperienceEvent(xdm: xdmData, datasetIdentifier: "datasetIdExample")
Copied!

Objective-C

Examples
1
//Example 1
2
// set freeform data to the Experience event
3
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
4
NSDictionary *data = @{ @"sample" : @"data"};
5
6
AEPExperienceEvent *event = [[AEPExperienceEvent alloc] initWithXdm:xdmData data:data datasetIdentifier:nil];
Copied!
1
//Example 2
2
// Set the destination Dataset identifier to the current Experience event:
3
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
4
5
AEPExperienceEvent *event = [[AEPExperienceEvent alloc] initWithXdm:xdmData data:nil datasetIdentifier:@"datasetIdExample"];
Copied!
See Edge Extension Usage for more examples.