image upload API failing

Discussions

Ask a Question
Back to All

image upload API failing

Dear people,

How do you use the image upload in the visual content moderation API? I mean uploading the data, not publicly hosting it and uploading the URL.

I tried to generate a request via the API docs:
https://docs.thehive.ai/reference/post_v2-task-sync

I've downloaded the 1x1 pixel (https://en.wikipedia.org/wiki/File:1x1.png) and uploaded it via the option "media stream". This generates the following requests on the docs page:


curl --request POST
--url https://api.thehive.ai/api/v2/task/sync
--header 'Authorization: Token {MY_API_TOKEN}'
--header 'accept: application/json'
--header 'content-type: application/json'
--data '
{
"image": "data:image/png;name=1x1.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
}
'


However, executing the request results in the following error:


{
"return_code": 400,
"message": "Expected input to be an object, received: data:image/png;name=1x1.png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII= - context: ["image"]"
}


What is the proper way of using this image upload API? (And could you maybe fix the docs page?)

Thanks in advance!