{"action":"closed","issue":{"url":"https://api.github.com/repos/muenzpraeger/salesforce-einstein-vision-apex/issues/5","repository_url":"https://api.github.com/repos/muenzpraeger/salesforce-einstein-vision-apex","labels_url":"https://api.github.com/repos/muenzpraeger/salesforce-einstein-vision-apex/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/muenzpraeger/salesforce-einstein-vision-apex/issues/5/comments","events_url":"https://api.github.com/repos/muenzpraeger/salesforce-einstein-vision-apex/issues/5/events","html_url":"https://github.com/muenzpraeger/salesforce-einstein-vision-apex/issues/5","id":218375213,"number":5,"title":"EinsteinVision_PredictionService.createExample gives error","user":{"login":"FishOfPrey","id":2396092,"avatar_url":"https://avatars2.githubusercontent.com/u/2396092?v=3","gravatar_id":"","url":"https://api.github.com/users/FishOfPrey","html_url":"https://github.com/FishOfPrey","followers_url":"https://api.github.com/users/FishOfPrey/followers","following_url":"https://api.github.com/users/FishOfPrey/following{/other_user}","gists_url":"https://api.github.com/users/FishOfPrey/gists{/gist_id}","starred_url":"https://api.github.com/users/FishOfPrey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FishOfPrey/subscriptions","organizations_url":"https://api.github.com/users/FishOfPrey/orgs","repos_url":"https://api.github.com/users/FishOfPrey/repos","events_url":"https://api.github.com/users/FishOfPrey/events{/privacy}","received_events_url":"https://api.github.com/users/FishOfPrey/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-03-31T01:45:39Z","updated_at":"2017-04-03T10:27:18Z","closed_at":"2017-04-03T10:27:18Z","body":"Hi, I'm trying to take a PNG blob from a ContentVersion and pass it into createExample().\r\n\r\nI keep getting the response message:\r\n\r\n> Response finished with Error: The 'name', 'labelId', and 'data' parameters are required to create an example.\r\n\r\nAnonymous Apex code:\r\n\r\n```\r\nVisionController vc = new VisionController();\r\nEinsteinVision_PredictionService ps = new EinsteinVision_PredictionService(vc.accessToken);\r\n\r\nlong datasetId = 1001419;\r\nlong labelId = 8588;\r\nId exampleId = '069o0000002CXDS'; // Rover.PNG\r\n\r\nBlob fileBlob = [Select VersionData from ContentVersion where ContentDocumentId = :exampleId order by VersionNumber desc limit 1].VersionData;\r\nEinsteinVision_Example ex = ps.createExample(datasetId, 'firstExample.png', labelId, fileBlob);\r\nSystem.assertNotEquals(null, ex);\r\n```\r\n\r\nI've checked that the `dataSetId` and `labelId` are correct.\r\n\r\nI was able to manually create the example using Postman in Chrome.\r\nhttps://www.dropbox.com/s/5lcwfw4wjeomf51/Postman.PNG?dl=0\r\n\r\nAny ideas?\r\n\r\nMaybe the body part for the image data needs a Content-Type header and the filename on the Content-Disposition?\r\n\r\nThe postman preview showed it as:\r\n\r\n```\r\n----WebKitFormBoundaryE19zNvXGzXaLvS5C\r\nContent-Disposition: form-data; name=\"data\"; filename=\"rover.png\"\r\nContent-Type: image/png\r\n\r\n\r\n----WebKitFormBoundaryE19zNvXGzXaLvS5C\r\nContent-Disposition: form-data; name=\"labelId\"\r\n\r\n8588\r\n----WebKitFormBoundaryE19zNvXGzXaLvS5C\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nrover.png\r\n----WebKitFormBoundaryE19zNvXGzXaLvS5C\r\n```\r\n\r\nThanks,\r\nDaniel\r\n\r\n"}}
{"actor":{"display_login":"muenzpraeger"}}