Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Update Attribute value of Recipient using Campaign Rest API

Vote:
 

Hi,

We are using Episerver campaign API(https://api.campaign.episerver.net/apidoc/index.html#/Recipients/) to manage recipients.

I need to update existing recipient attributes and I am using this post request https://api.campaign.episerver.net/apidoc/index.html#/Recipients/modifyRecipientAttributes for the update.

This API requires attributes to added like "data.[attribute] according to the corresponding recipient list field."

I have tried adding attributes like this 'data.firstname' but no success.

And returned status from API is not very helpful in troubleshooting as it always returns "Not found" result.

Any suggestions?

#224657
Jun 24, 2020 8:19
Vote:
 

Hello there,

having the same problem here - for me it's not clear how to send the data.

Should it be a string, appended to the request? Should it be an array inside of POST?

Please help.

#297554
Mar 02, 2023 16:16
Vote:
 

Can anyone provide an example of how to update/set custom recipient properties?

#297557
Mar 02, 2023 16:32
Vote:
 

Hi, I have solution that worked for me in a curl request. You need to put it in the request body with the mode set.

As example for the request body: 

-d "mode=set&data.YOURATTRIBUTE=true"

if your attribute is a boolean value

If you have a String value, it's almost identical: 

-d "mode=set&data.YOURATTRIBUTE=NEWSTRING"

If you want to update multiple values at once, just append them in the request body: 

-d "mode=set&data.YOURATTRIBUTE=true&data.YOURATTRIBUTE=NEWSTRING"

As you see, you always need the "data." String in front of your attribute to make it work.

The "mode=set" overwrites the current value of your attribute. The are different modes listed in the swagger documentation.

Here is a finally example how a complete curl request can look like:

curl -X POST "BASE_SERVER_URL/rest/YOUR_CLIENTID/recipients/YOUR_RECIPIENT_LIST_ID/RECIPIENT_ID" -H "accept: application/json" -H "Authorization: YOUR_API_KEY" -H "Content-Type: application/x-www-form-urlencoded" -d "mode=set&data.YOURATTRIBUTE=true&data.YOUSTRINGATTRIBUTE=NEWSTRING"
#310110
Edited, Oct 05, 2023 13:29
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.