Recommendations JSON

Avatar

Avatar

neilh83114327

Avatar

neilh83114327

neilh83114327

27-11-2017

On the Design Overview page of the Recommendations documentation it says "Target can also return recommendations as a JSON object."  It gives an example output of the JSON that can be generated. However, the topic of generating JSON is not discussed anywhere in that section. I imagine this is either accomplished in a design or an mbox parameter, but I cannot find any further discussion of the topic.  How is this accomplished?

A related question: the documentation says that Designs use Apache "Velocity Version 1.5 with no additional tools or libraries" (such as EscapeTool, which would be very useful!!). However, I swear I recall seeing an article somewhere on how to escape quotes for JavaScript in the Velocity used in Recommendations-- but I can't find it again!  Is this possible? I'd like to escape single quotes so that valid JavaScript/JSON can be created when they appear in recommendations content.

Thanks for any assistance you can offer!

View Entire Topic

Avatar

Avatar

Jon_Tehero

Employee

Avatar

Jon_Tehero

Employee

Jon_Tehero
Employee

04-01-2018

Yes, you are correct. Thanks for bringing this to our attention!

I've made corrections to the text below.

5. After your activity is setup and activitate, you can setup a sample request to get back the clean JSON response. Note: from the time that you save your activity, Target will need to build a model to support the Criteria configuration selected. Depending on a number of factors, this could take some time. Results will appear once the model has build.

  • http://[YOUR_CLIENT_CODE].tt.omtrdc.net/m2/YOUR_CLIENT_CODE/ubox/raw?mbox=[YOUR_MBOX_NAME]&mboxConte...
  • Where:
    • [YOUR_CLIENT_CODE] = your Target Client code (available on ../target/products.html#recsSettings > Recommendation API Token > Client Code
    • [YOUR_MBOX_NAME] = the name you've selected in the "locations" section of the form-based Recommendations, in this case Sample_Recs_Response
    • [ENTITY_ID] = The entity.id of an item in your catalog
    • [AT_PROPERTY_TOKEN] = optional. Add if you've selected a Property (part of Enterprise Permissions) during your activity setup.