O'Reilly logo

Learning Salesforce Einstein by Mohith Shrivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The SimilarProductRecommender component

Once the engine template (Similar Products Engine Template) is deployed, built, and trained, we can ask for a recommendation by calling the query endpoint, which will be of the https://<appname>.herokuapp.com/queries.json format.

The query-input JSON data for the engine template we currently have will be of the following format:

    {     "items": ["i1"],     "num": 4    }

The results will be of the following format:

      {        "itemScores": [{           "item": "i4",           "score": 0.45        },         {           "item": "i5",           "score": 0.50         }        ]      }

The Apex code to invoke the query API is as follows:

      public class SimilarProductRecommenderController {       @AuraEnabled       public static list<Product2> queryPredictionAPI         (String productId){ list<Product2> lstProducts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required