Expand my Community achievements bar.

Join us for an upcoming in-person Adobe Target Skill Builders event ~~> We're hosting these live learning opportunities to equip you with the knowledge and skills to leverage Target successfully. Learn more to see if we'll be coming to a city near you!
SOLVED

Receiving Recommendations in HTML Format Inside JSON Response from Recommendations API

Avatar

Level 3

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.

ZvoidZ_0-1701696222597.png

 

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.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

5 Replies

Avatar

Employee Advisor

Just to be sure, do you have the "HTML Design" option toggled off in your Recommendations design?

By default it's enabled:
alexbishop_0-1701698239479.png

 

Avatar

Level 3

Yes, I have disabled the "HTML Design" option in my Recommendations design.

ZvoidZ_0-1701698647160.png


Is there any other configuration or step that I might be missing to ensure the recommendation content is delivered in JSON format?

 

Avatar

Correct answer by
Employee Advisor

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

Avatar

Level 3

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!