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

Train dataset using Apex

To train the dataset, the sample CURL command is as follows:

curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "name=Customer Service Item Model" -F "datasetId=1002055" https://api.metamind.io/v1/vision/train

As noted, the request involves a content type of multipart. We will use the utility we built while creating a dataset to form the request body. The following is the utility to build the blob request body:

    private static Blob buildBlobBody(String name,String datasetId) {      String body = '';      body += EinsteinVisionUtility.WriteBoundary();      body += EinsteinVisionUtility.WriteBodyParameter('name', name); body += EinsteinVisionUtility.WriteBoundary(); ...

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