Does Target Recommendations API supports multi-value fields?

Description

Environment

  • Target



 


Issues/Symptoms


Does Target Recommendations API supports multi-value fields like mbox or Launch meta tags do? For example, with an mbox, you can do:

adobe.target.getOffer({
"mbox": "DemoMBoxCanBeDeleted",
 "params":{
  'entity.id':         '123',
  'entity.MultiValueAttribute': '"X", "Y", "Z"'
 },
 "success": function(offer) {
  console.log("Result: "+JSON.stringify(offer));
 },
 "error": function(status, error) {
  console.log('Error', status, error);
 }
});



That will be stored in Target’s catalog as an array to be used in an activity. However, passing in a string of “X”, “Y”, “Z” through the back end of the API stores a string, not array and passing in a JSON array results in a 400 error. Is there syntax or documentation that should be followed on this?

Resolution

This should work. Its been tested using the GET entity to see another entity that had been passed a multi-value attribute. Then used the same format in a POST (save) entity call. It has worked fine in the past.

 
It should be passed as a stringifiedJSON array by escaping the double quotes inside the array. Here’s the syntax used for above test:

{
    "entities":
        {
            "attributes": {
                "message": "test tool yo",
                "multiVal1": "\"X\",\"Y\",\"Z\""
            },
            "categories":
                "test"
            ,
            "environment": "183214",
            "id": "prod12",
            "name": "multi-val-via-RecsEntityAPI"
        }

}

On this page