After successfully using Postman to send a JPEG image to Kairos, I tried using the suggested C# code as shown below from a C# .Net environment:
var client = new RestClient(“https://api.kairos.com/detect”);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader(“Content-Type”, “application/json”);
request.AddHeader(“app_id”, “xxx”);
request.AddHeader(“app_key”, “xxxx”);
request.AddFile(“image”, “/C:/Users/Simon/AppData/Local/Temp/Test (36).jpg”);
IRestResponse response = client.Execute(request);
This caused an illegal path error in Request.Addfile before execution. Removing the first / from the second AddFile parameter, the command was executed but returned the error “image one or more required parameters are missing”. Changing all the / characters to \ did not make any difference.
I have tried converting the file to a byte array as shown below:
byte [] fileBytes = File.ReadAllBytes(imageFilePath);
request.AddFileBytes("image", fileBytes, "imageFilePath", "application/octet-stream");
and received the same error