Expand my Community achievements bar.

Applications for the 2024 Adobe Target Community Mentorship Program are open! Click to the right to learn more about participating as either an Aspirant, to professionally level up with a new Certification, or as a Mentor, to share your Adobe Target expertise and inspire through your leadership! Submit your application today.
SOLVED

Accessing Recommendation Data through Target APIs

Avatar

Community Advisor

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

1 Accepted Solution

Avatar

Correct answer by
Employee

Hmm, that shouldn't be happening. I just confirmed that I am able to append the pageURL, host and impressionId to an existing server-side request that I am using in an activity and everything worked for me.

I recommend that you create a brand new Design (from scratch) from withing the Design library. To do this, go to https://{{your-tenant-name-here}}.marketing.adobe.com/content/mac/{{your-tenant-name-here}}/target/products.html#designs and BEFORE you save it, ensure that it is NOT an HTML-based Design.

After you've done that, go ahead and update your form-based activity to use that Design.

If you still have a problem after that, please submit a bug with all the details to our customer care team (tt-support@adobe.com) so we can investigate.

View solution in original post

6 Replies

Avatar

Community Advisor

Guys, Any help here?

Regards,

Runal

Avatar

Employee

Hi Runal,

Recommendations can be delivered via API as long as it is configured via the form-based editor (not the Visual Experience Composer). When creating the activity, make sure the turn off the "HTML Design" toggle so that the output isn't wrapped in <div> tags. This will allow for a clean JSON or raw text output.

1326598_pastedImage_0.png

Avatar

Community Advisor

Hi Jon,

Thats exactly the way we did it. But there was another quick thing I wanted to confirm, if you know.

When I try to pass target params in the API, I run into error the same visual form error:

Request:

{

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

  "thirdPartyId" : "1313131231",

  "requestLocation" : {

    "pageURL" : "https://something.com/abc/xyz/#datapullbycatgid", 

    "host" : "something.com",

    "impressionId" : "1"

  },

  "mboxParameters" : {

    "categoryId" : "Action"

  }

}

Response:

{

    "status": 501,

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

}

Not sure why it starts considering the form based activity to a visual offer activity, with the params, if I remove the mboxparameters from the request, then everything works fine.

Have you faced it before? is there a way to overcome this?

Regards,

Runal

Avatar

Correct answer by
Employee

Hmm, that shouldn't be happening. I just confirmed that I am able to append the pageURL, host and impressionId to an existing server-side request that I am using in an activity and everything worked for me.

I recommend that you create a brand new Design (from scratch) from withing the Design library. To do this, go to https://{{your-tenant-name-here}}.marketing.adobe.com/content/mac/{{your-tenant-name-here}}/target/products.html#designs and BEFORE you save it, ensure that it is NOT an HTML-based Design.

After you've done that, go ahead and update your form-based activity to use that Design.

If you still have a problem after that, please submit a bug with all the details to our customer care team (tt-support@adobe.com) so we can investigate.

Avatar

Community Advisor

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

Avatar

Level 2

I just wanted to mention something that happened to me. I didn't realize that I was using an mbox which was associated with other (HTML) type offers. The first thing you'll want to do if this is happening is make sure that the mbox that you're using for the api calls is unique and not associated with other HTML offers.

Hopefully that helps someone.