Closed FishOfPrey closed 7 years ago
Well, that was some interesting learning about base64 encoding and appending a file when using multipart/form-data.
The problem is largely covered in POST Mutipart/form-data with HttpRequest. The short version is if you aren't really careful the last few bytes of the file can get corrupted as part of the base64 encoded.
I needed to swap out the EinsteinVision_HttpBodyPart.WriteBodyParameter
method with a new one when used by EinsteinVision_HttpBodyPartExample
to encode the example blob data.
I'll see if I can put this together in a pull request.
LMK if I should jump on that.
I've taken that part of the wrappers directly from the MetaMind repo, so we should let them know too.
I've had a go at addressing it in the patch request. It isn't complete as the mimetype is hard coded to PNG. Would also benefit from some apex test cases.
It did work in the one test I completed.
Hi, I'm trying to take a PNG blob from a ContentVersion and pass it into createExample().
I keep getting the response message:
Anonymous Apex code:
I've checked that the
dataSetId
andlabelId
are correct.I was able to manually create the example using Postman in Chrome. https://www.dropbox.com/s/5lcwfw4wjeomf51/Postman.PNG?dl=0
Any ideas?
Maybe the body part for the image data needs a Content-Type header and the filename on the Content-Disposition?
The postman preview showed it as:
Thanks, Daniel