$p("setArrayRequestFields")

$p(setArrayRequestFields): String[] -> undefined

If you uploaded an item metadata that contains array of Strings, then you must specify that field as an Array to get it returned to you as an Array from recommendations. For example, let's say you have a field named authors for each articles you are serving.

// Register call to get 100 recommendations for widget 'default-widget'.
// Apply a simple callback to print out the JSON response.
$p('register', {
                  max: 100, // Large number requested so you can see our full range of items
                  widget: 'default-widget', // name of widget
                  callback: function(resp) {
                    console.log(JSON.stringify(resp, null, 2));
		    						console.log("// TEST.");
                  }
               }
);
$p("setRequestFields",["url","date","views","authors"]) // Set request fields
$p("setArrayRequestFields", ["authors"]) // Set array request fields
// Execute the registered call.
$p('fetch');

code above will return authors field as an array of Strings. If an array field isn't declared as an array request field, then first item of the array will be returned.

If you have run:

$p("setRequestFieldsAON", true)

Then we will return only the items that have all the request fields (set using setRequestFields) and all the array request fields (set using setArrayRequestFields).

If you want to force us to return some or all of the array request fields for all items, but you do not want to use setRequestFieldsAON (because there are non-mandatory fields) you can run the following:

$p("setMandatoryArrayRequestFields",["list","of","mandatory","array","request","fields"]);