I am working with the Recommendations API as detailed in the Adobe Experience League documentation. I am encountering an issue with the format of the recommendation content within the JSON response.
https://{{CLIENTE_CODE}}.tt.omtrdc.net/rest/v1/delivery?client={{CLIENTE_CODE}}&sessionId=1234567
Initially, I was receiving a 400 status error with the message "Errors: field - [context.channel] - must not be null;". To address this, I amended my request body as follows:
{
"context": {
"channel": "web"
},
"execute": {
"mboxes": [{
"name": "api-mbox",
"index": 1
}]
}
}
This rectified the error, and I am now successfully receiving responses. However, despite having specified in the design of the recommendation within Adobe Target that the format should be JSON, the recommendation content is being returned in HTML format.This is a crucial aspect for me, as I need the recommendation content to be in JSON to align with the configurations I've set in Adobe Target.
Could anyone advise how to ensure that the recommendation content is delivered in JSON format as per the settings in Adobe Target? I am looking for guidance on adjusting the API call or the request to meet this requirement.
Thank you in advance for your help.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
I have done a bit more digging - currently the responses will be html formatted (even when using a non-HTML design), when you use the delivery API. There is a ticket raised internally for this but no timeline yet, so currently there are a couple of different options:
i) Use the legacy API and ensure that contentAsJson is set to "true" in the request payload (more details here)
ii) Continue with the delivery API and use the escaper function to handle the special characters
Just to be sure, do you have the "HTML Design" option toggled off in your Recommendations design?
By default it's enabled:
Yes, I have disabled the "HTML Design" option in my Recommendations design.
Is there any other configuration or step that I might be missing to ensure the recommendation content is delivered in JSON format?
I have done a bit more digging - currently the responses will be html formatted (even when using a non-HTML design), when you use the delivery API. There is a ticket raised internally for this but no timeline yet, so currently there are a couple of different options:
i) Use the legacy API and ensure that contentAsJson is set to "true" in the request payload (more details here)
ii) Continue with the delivery API and use the escaper function to handle the special characters
Thank you so much for the additional research and insights. I have tried using the legacy API and set 'contentAsJson' to 'true' in the request payload, as you suggested, and it worked perfectly. I really appreciate your support and assistance in resolving this issue. Your guidance has been immensely helpful!
No problem at all, happy to help!
Views
Replies
Total Likes
Any idea where this ticket stands? I'm having the same issue, but unfortunately can't seem to get the legacy API to work.
Views
Replies
Total Likes
Views
Like
Replies
Views
Like
Replies