Skip to main content
All CollectionsAPSIS One APIGuides & Best practice
Post Custom Events to Profiles with the APSIS One API
Post Custom Events to Profiles with the APSIS One API
Rikke Søndergaard avatar
Written by Rikke Søndergaard
Updated over a week ago

How to Post Custom Events to Profiles

This article will guide you through the steps of posting Custom Event data into Profiles in your APSIS One Audience.

The steps described in this guide will allow you to post a Custom Event into APSIS One Profile.

Before you begin

You'll need to be familiar with Profile data, specifically Events and Custom Events to make the most out of this article.


In this Article


Create a Custom Event

Start by creating a Custom Event. Here's where you can read more about how to create a Custom Event in APSIS One!

For this guide we'll use the Custom Event shown below, with Read and Write permissions within the Email Keyspace.


Fetch Event Types

Once we have defined our Event, we can fetch all the Event types available.

Per region host names

APSIS One API is provided under different hostnames depending on your region. For EU use https://api.apsis.one/ and for APAC call https://api-apac.apsis.one/.

Take a look at the example below and see how you can make an API call to get the available Events in your APSIS One account:

curl --request GET\
  --url https://api.apsis.one/audience/sections/usercreated.sections.my_section-h4h3dpu3qi/events \
  --header 'authorization: Bearer '

Missing an Access Token?

A successful call will return a JSON object with all the Event types.

Keyspaces have different read and write restrictions for different types of Events.

For now, these restrictions cannot be changed. Stay tuned for updates, as we're working on allowing APSIS One users to modify these rights when working with the API.

See the JSON snippet below for how your Custom Event looks like:

{ 
  "name": "my transaction",
  "discriminator": "com.apsis1.events.transaction.custom-my-transaction-l9ce3syo6t",
  "description": "",
  "versions": [ 
    { 
      "id":"2565266",
      "type":{ 
        "myNumberField": "integer",
        "myNumberWithDecimalField": "double",
        "myTextField": "string",
        "myTrueFalseField": "boolean",
        "source": "string"
      },
      "deprecated_at": null,
      "valid_from": "2021-01-07T12:17:56.054Z"
    }
  ]
}

Post Custom Event to a Profile

Once we've successfully gotten the Custom Event from your APSIS One account, we're ready to post it to a Profile.

To post a Custom Event to a Profile we'll need the following data:

  • A valid Section discriminator

  • A valid Keyspace discriminator

  • Profile Key

  • A valid Event

  • Version ID of the Event

  • Valid Event Data corresponding to the Event definition

  • A valid Event time in ISO 8601 format

Note: When creating our Custom Event definition, we have enabled Email Keyspace to be able to read and write this event type so now we will be able to use this very Keyspace in Allowed Operations.

The Event post method allows you to post several Events in one call, but in this case we'll post only one.

Let's post a Custom Event to our sample Profile, Steve.

A successful call will return a HTTP 204 No Content status code.

curl --request POST\
  --url https://api.apsis.one/audience/keyspaces/com.apsis1.keyspaces.email/profiles/steve%40apsis.com/sections/usercreated.sections.my_section-h4h3dpu3qi/events \
  --header 'authorization: Bearer '
  --data '{
  "items": [
    {
      "event_time": "2020-10-14T09:43:34.471Z",
      "version_id": 2565266,
      "data": {
        "myNumberField": 27183,
        "myNumberWithDecimalField": 213.21,
        "myTextField": "some transaction",
        "myTrueFalseField": false,
        "source": "some web shop"
      }
    }
  ]
}'

That's It!

Our APSIS One Profile Steve now contains this Custom Event!


What's Next?

Did this answer your question?