Hi,
Am tyring to make an external API Call from HANA XS classic by uploading an Image to Public ML API, however the call fails with invalid Key error.
Please see below the code, can you kindly suggest the right way to pass the Key -value pairs for such calls
var ImageDecoded = $.util.codec.decodeBase64(image); // image is read from DB
request.contentType = "multipart/form-data";
var entity = request.entities.create();
request.entities[0].contentType = "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"; // Copied the boundary from Postman generated code
request.entities[0].headers.set("------WebKitFormBoundary7MA4YWxkTrZu0gW" +
"Content-Disposition", "form-data;" +
"name=\"imageupload\";" +
ImageDecoded +
"Content-Type: image/jpeg" +
"------WebKitFormBoundary7MA4YWxkTrZu0gW--");
request.entities[0].setBody(ImageDecoded);
client.request(request, "http://xx.xx.xx.xx:pppp/getImage");
var response = client.getResponse();
The response from the server is
BadRequestKeyError: 400 Bad Request: KeyError: 'imageupload'
Thanks
Sudarshan