[Bonus] Exploring the Segmentation Service API
In this exercise, you’ll use Postman and Adobe I/O to create a segment and store the results of that segment as a dataset, by making use of Adobe Experience Platform’s APIs.
In the Real-time Customer Profile, all profile data is shown alongside event data and existing segment memberships. The data that is shown can come from anywhere, from Adobe applications and external solutions. This is the most powerful view in Adobe Experience Platform, the experience system of record.
Creating a segment using the AEP API's require a number of steps in Postman. But first...
- Locate the AEP Bootcamp - Sandbox 20 collection.
- Open the Segmentation Service API folder.
We will first create a segment definition.
- Select POST Create a new segment definition.
- Click on the Body tab to see the body of the request.
You see the segment expression defined in the Profile Query Language, PQL. You can find more information and documentation about PQL.
- Update the name value within the Body request. E.g. replace demo with your user identification.
- The body should look like:
You should also verify the headers of your request.
- Select Headers tab.
- You will see same set of header key/value pairs as in the earlier Postman example requests.
To create the segment:
- Click on Send.
- View the results in the Body section at the bottom.
You can now also view your segment definition in the UI.
- Login to Adobe Experience Platform.
- Go to Audiences.
- Select Browse tab.
You should see your created segment in the list of Audiences:
In the previous exercise, you created a streaming segment. A streaming segment continuously evaluates qualifications in real-time. What we will do now is creating a batch segment. Batch segment gives you a preview of what the segment could look like in terms of qualifications, but is doesn’t mean that the segment has actually run. Currently, nobody qualifies for this segment. To make people qualify, the batch segment needs to run, which is exactly what we’ll do here.
Let’s now POST a Segment Job.
- Go to Postman.
- Open the Segmentation Service API folder (if not already open).
- Select the POST Create a segment job request.
- Click on Send.
The segment job is now running, and this may take some time.
To get an update on the status of the segment job:
- Go to Postman.
- Select the GET Retrieve a segment job request.
- Click on Send.
You will most likely see in the Body response that the request is QUEUED. You can repeat this request multiple times and after a while status should be set to SUCCEEDED.
Once the status is SUCCEEDED, your segment job has run and customers are now qualifying for the segment.
You have now successfully created a streaming and a batch segment using the Adobe Experience Platform APIs.