curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Failed to use MathpixOCR JSON API with curl.

From: Jeremy Nicoll via curl-users <>
Date: Wed, 09 Jun 2021 10:44:58 +0100

On Wed, 9 Jun 2021, at 04:15, Hongyi Zhao via curl-users wrote:
> According to the instruction given on the MathpixOCR API official
> website here, <>, as shown
> below:
> curl -X POST \
> -H 'app_id: YOUR_APP_ID' \
> -H 'app_key: YOUR_APP_KEY' \
> -H 'Content-Type: application/json' \
> --data '{ "src": "data:image/jpeg;base64,'$(base64 -i limit.jpg)'" }'
> I use the following code with my own app_id and app_key to test the
> OCR accuracy of MathpixOCR:
> $ curl -x socks5:// -X POST
> -H 'app_id: my_app_id' -H
> 'app_key: my_app_key' -H 'Content-Type: application/json'
> --data '{ "url": "data:image/jpg;base64, '$(base64 -i
> schrodinger.png)'" }'
> {"error":"SyntaxError: Unexpected end of JSON

Does it matter that despite the webpage saying that the --data value
should start with "src", you used "url"?

Have you tried checking the syntax of your JSON parameters, either
at an online JSON unscrambling/formatting page, or in your own code?

> From my point of view, the test example
> of mine is exatly same with the official sample code.

It clearly is not. But I have no idea if the difference matters.

Jeremy Nicoll - my opinions are my own.
Received on 2021-06-09