Accessing Recommendation Data through Target APIs

Avatar

Avatar

Runal_Trivedi

MVP

Avatar

Runal_Trivedi

MVP

Runal_Trivedi
MVP

03-07-2017

Hi,

We have a requirement where we have to access the recommendation data through API, and show the each Recommended Item at specific location in result set on the landing page. Consider as in search results, you are injecting recommended items at specific locations.

For this I have a recommendation activity running on a page that return me the result set, when I use the standard replace content option in activity settings.

I tried to access the same activity on that page using the standard Target APIs. For e.g.:

I referred documentation as mentioned by Adobe on following page - Delivery

Steps I followed: I Used POSTMAN (Chrome addon) to test this.

POST URL - http://clientid.tt.omtrdc.net/rest/v1/mbox/12223434537?client=clientid

Request JSON:

{

  "mbox" : "target-global-mbox", 

  "requestLocation" : {

    "pageURL" : "http://www.abc.com/test/parentpage/child-page/some-targeted-page", 

    "host" : "www.abc.com",

    "impressionId" : "1"

  },

  "mboxParameters" : {

    "screenHeight" : "900",

    "screenWidth" : "1440",

    "browserWidth" : "1440",

    "browserHeight" : "278",

     some other parameters...

  }

}

But when I try to hit above request in POSTMAN, I always get below response:

Response:

{

    "status": 501,

    "message": "Unable to serve visual offers through server-side calls"

}

To debug further, I tried to change the call to non-recommendation activity type, like a standard A/B testing. But that too gives me the same response.

I have following questions related to above requirement:

1. Is it possible to programmatically access the Recommendation result set? If yes, then if someone can please provide any pointers?

2. What is wrong with above request/response. I am following the github example as listed here - Lesson 1: The Tools of the Trade · Adobe-Marketing-Cloud/target-api-examples Wiki · GitHub

  •      Only change I have made to my request is; I am not generated thirdpartyID, as I don't have a need to track this as a user behavior, and I just need to provide recommendations, in a scattered way on some landing page.

Please let me know if anyone has tried such thing, and what is the ideal way to achieve it.

Thanks in Advance!

Runal

View Entire Topic

Avatar

Avatar

Runal_Trivedi

MVP

Avatar

Runal_Trivedi

MVP

Runal_Trivedi
MVP

18-10-2017

Hi Jon,

This is particularly happening when we provide mboxParameters in the API call. My Ultimate goal was to run the recommendations filter criteria based on the mboxParameters passed in the API call. In below example, I wanted to filter the recommended results that matched category "Action". But the moment I provide mboxParameters in the API call, it starts throwing the 501 error code, and starts complaining as if the recommendation activity was visual offer.

"mboxParameters" : {

    "categoryId" : "Action"

  }

Can you try it once and see if things work fine for you using mboxParameters? if so, then I will log the day-care tickets.

Documentation doesn't mention any API level restriction in using mboxParameters in API calls, so I assume it will result into a product bug. But, please, it will be great, if you can confirm once.

Regards,

Runal