Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3688

Curl POST

$
0
0

Hello,

I’m using an old RealStudio 2011 release to update some features for an old project and I’m facing some issues with using a curl request.
I want to use an online OCR API, which can be called with a curl request.
The example on the site looks like this:

curl -X POST \\
  https://api.mindee.net/v1/products/mindee/invoices/v4/predict \\
  -H 'Authorization: Token my-api-key-here' \\
  -H 'content-type: multipart/form-data' \\
  -F document=@/path/to/your/file.png

I try to use it in the project like this in a pushbutton action event:

  Dim d As New Dictionary
   
  // This service simply returns the post data as the result
  Dim result As String

  result = Socket.Post("curl -X POST 'https://api.mindee.net/v1/products/mindee/invoices/v4/predict' -H 'Authorization: myAPIkey' -H 'content-type: multipart/form-data' -F document=@d:/DOWNLOAD/fact.pdf", 30)
  
  result = DefineEncoding(result, Encodings.UTF8)
  
  MsgBox(result)

Socket is a HTTPSocket.

I get a response of “400 Bad Request”.

What am I doing wrong?

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 3688

Trending Articles