我有一个REST API,其终点是
端点:http://puthi-ocr.com/upload或http://10.101.0.154/upload
描述:用于上载图像文件的API端点。使用此端点上传图像。
技术细节:
请求类型:POST
授权:NoAuth
标题:null
正文:表单数据
Key: "sampleFile"
Value: the image file itself
成功上传后,您将获得相应的文件名(每次上传都是唯一的),以便使用其他API端点进行进一步的OCR操作。
如何发布图像的值?
答案 0 :(得分:0)
您应该使用MultipartBody
MultipartBody.Part image= MultipartBody.Part.createFormData(/*image key*/, fileImage.getName(), RequestBody.create(MediaType.parse("image/jpg"), fileImage));