Expand my Community achievements bar.

SOLVED

Set up API to subscribe to service via email form

Avatar

Level 3

Hi,

How could I set up an API call from our website where we have a signup form with email address and then match the email address with a profile and subscribe the profile to a specific service? Or if a profile is not found on the email a new profile is created.

Is this possible? I tried to check the documentation but had a hard time understanding the logic.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @filipe23353816,

 

I believe the below steps/process helps addresses your need.

 

Step1:
Setup filter with email address

https://experienceleague.adobe.com/docs/campaign-standard/using/developing/adding-or-extending-a-res...

 

Step2:

Make a GET call on the email address
GET https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/byEmail?email=<<email_address>>

Retrieve the subscriptions URL from the response.

 

Step3:

If you don't find the record with the email address for the GET request made previously create the profile and subscribe to the service by following steps 4, 5, &6 else jump to step 7.

 

Step4:

To create a profile

POST https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/

 

Step5:

GET call on the email address
GET https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/byEmail?email=<<email_address>>

Retrieve the subscriptions URL from the response.

 

Step6:

Perform a POST request on the subscriptions URL with the desired service Primary Key inside the payload.

POST https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

-d '{"service":{"PKey":"<PKEY>"}}

 

Step7:

If the profile found with the email address perform a GET request on the subscriptions URL received from step 2.

GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

It returns the list of services to which the profile subscribed.

 

Step8:

If you don't see the subscription service for the profile create a subscription for the service.

Perform a POST request on the subscriptions URL with the desired service Primary Key inside the payload.

POST https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

-d '{"service":{"PKey":"<PKEY>"}}

Thanks, Sathees

View solution in original post

10 Replies

Avatar

Correct answer by
Community Advisor

Hi @filipe23353816,

 

I believe the below steps/process helps addresses your need.

 

Step1:
Setup filter with email address

https://experienceleague.adobe.com/docs/campaign-standard/using/developing/adding-or-extending-a-res...

 

Step2:

Make a GET call on the email address
GET https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/byEmail?email=<<email_address>>

Retrieve the subscriptions URL from the response.

 

Step3:

If you don't find the record with the email address for the GET request made previously create the profile and subscribe to the service by following steps 4, 5, &6 else jump to step 7.

 

Step4:

To create a profile

POST https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/

 

Step5:

GET call on the email address
GET https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/byEmail?email=<<email_address>>

Retrieve the subscriptions URL from the response.

 

Step6:

Perform a POST request on the subscriptions URL with the desired service Primary Key inside the payload.

POST https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

-d '{"service":{"PKey":"<PKEY>"}}

 

Step7:

If the profile found with the email address perform a GET request on the subscriptions URL received from step 2.

GET https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

It returns the list of services to which the profile subscribed.

 

Step8:

If you don't see the subscription service for the profile create a subscription for the service.

Perform a POST request on the subscriptions URL with the desired service Primary Key inside the payload.

POST https://mc.adobe.io/<ORGANIZATION>/campaign/profileAndServices/profile/<PKEY>/subscriptions

-d '{"service":{"PKey":"<PKEY>"}}

Thanks, Sathees

Avatar

Level 3

Hi,

What constitutes the <ORGANIZATION> and <PKEY> and how can I find these values?

Avatar

Level 3

Organization is the Organization Id under Credential details?

But the PKEY I am not sure how to find. I thought that was depending on the service that you wanted to use for creating a subscription on a profile?

Avatar

Community Advisor

@filipe23353816 Organization is Organization Id.

You can try making a GET request with one of the email addresses and the response received will have PKEY.

Thanks, Sathees

Avatar

Level 3

I have created a filter now with email address. Label is "Email". ID is "emailFilter". What will be the customerfiltername used in the API call? Is it GET https://mc.adobe.io/<<ORGANIZATION>>/campaign/profileAndServicesExt/profile/byemailFilter?email=<<email_address>>

 

filipe23353816_0-1686746493682.png

 

Avatar

Level 6

Hi @filipe23353816 ,

It is basically work like :-

byMemberid?sd_parameter=123456789 :- This contains the filter and filter parameter

 

In your case it should be byemailFilter?email_parameter="abc_gmail.com"

 

 

Avatar

Level 3

Thank you! I have now managed to test the API calls in Postman.

I got a question from our website developers. They asked about if the logic for checking if a profile exist (as an example) needs to be done on their end or if that could be handled on the Adobe side?

 

Avatar

Level 6

Hi @filipe23353816 

CC @SatheeskannaK 

So I am putting my 2 cents here, @SatheeskannaK  feel free to reply for further help.

 

App developers has to use get api as given above and if they got the profile by filtering on email id, then based on payload they can determine that profile exist in adobe campaign database or not.

 

Now they have to develop the logic of capturing payload and accordingly based on response, what action they need to take on payload or if no record exist.

Avatar

Level 6

Hi @filipe23353816 ,

Giving you one of example as below on which I was working in past :-

 

  1. A new user (whose profile is not already exist in ACS) fills the form for app consent.

 

For this case sample get call will return below value:-

 

Sample get call for user with email :- example@example.com This user doesn’t exist in database.

 

https://mc.adobe.io/ex-mkt-stage1/campaign/profileAndServicesExt/profile/byText?text=example@example...

 

Response Payload :-

 

        "href": "https://mc.adobe.io/example-mkt-stage1/campaign/profileAndServicesExt/profile//byText/_count?text=ex...",

        "value": 0

    },

    "serverSidePagination": true