How to Subscribe a Profile to a Topic

This guide will show you how to subscribe a Profile to a Topic inside a Consent list for email communications, by specifying the Email Keyspace and corresponding Profile Key (email address).

To subscribe a Profile to a Topic we'll need the following.

  • Valid Section from the APSIS One account

  • Valid Consent list from the Section

  • Valid Topic from the Consent List

  • The Email Keyspace

  • A Profile Key for the Email Keyspace, an email address.

Ready?

Start by fetching the Section:

Per region host names

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

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

A successful call will return the following JSON object.

{
  "items": [
    {
      "discriminator": "usercreated.sections.apsis_data-huid9arn25",
      "name": "APSIS Data",
      "description": null
    }
  ]
}

Then fetch the Consent Lists from the Section.

curl --request GET \
  --url https://api.apsis.one/audience/sections/usercreated.sections.apsis_data-huid9arn25/consent-lists \
  --header 'authorization: Bearer '

A successful call with all the Consent Lists on a Section will look like this.

{
  "items": [
    {
      "discriminator": "usercreated.targets.all_profiles-5dwg9vo4f1",
      "name": "All Profiles",
      "description": null
    }
  ]
}

Proceed to get the Topics from a Consent list you got previously from the Section.

curl --request GET \
  --url https://api.apsis.one/audience/sections/usercreated.sections.apsis_data-huid9arn25/consent-lists/usercreated.targets.all_profiles-w6k6v1vnxu/topics \
  --header 'authorization: Bearer '

A successful call will return the following JSON object.

{
  "items": [
    {
      "discriminator": "usercreated.topics.jeans-zz8xl5pcnp",
      "name": "Jeans",
      "description": null
    },
    {
      "discriminator": "usercreated.topics.jacket-ishl98sfdi",
      "name": "Jacket",
      "description": null
    },
    {
      "discriminator": "usercreated.topics.sweater-ufm96dn2e8",
      "name": "Sweater",
      "description": null
    },
    {
      "discriminator": "usercreated.topics.accessories-djf83475r7",
      "name": "Accessories",
      "description": null
    }
  ]
}

The next step is to associate the Profile with the Topic. This Topic, of course, from the Consent list in the Section we're working with.

For this example, we'll use:

  • The standard Email Keyspace: com.apsis1.keyspaces.email

  • The Profile Key: andy@apsis.com

curl --request POST \
  --url https://api.apsis.one/audience/keyspaces/keyspace/profiles/andy%40apsis.com/sections/usercreated.sections.apsis_data-huid9arn25/subscriptions \
  --header 'authorization: Bearer ' \
  --data '{"consent_list_discriminator":"usercreated.targets.all_profiles-5dwg9vo4f1","topic_discriminator":"usercreated.topics.jeans-zz8xl5pcnp"}'

A successful call with return a HTTP 201 Created status code with the following JSON object.

{
  "id": "dXNlcmNyZWF0ZWQudGFyZ2V0cy5hcHNpc19kYXRhLWplZjZwM2M2M2NfdXNlcmNyZWF0ZWQudG9waWNzLnRlc3QtbzVubTZwdjcycQ==",
  "consent_list_discriminator": "usercreated.targets.all_profiles-5dwg9vo4f1",
  "topic_discriminator": "usercreated.topics.jeans-zz8xl5pcnp"
}
Did this answer your question?