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.
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Jeremy Nicoll via curl-users <curl-users_at_cool.haxx.se>
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, <https://docs.mathpix.com/#request-parameters>, as shown
> below:
>
> curl -X POST https://api.mathpix.com/v3/text \
> -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://127.0.0.1:18888 -X POST
> https://api.mathpix.com/v3/latex -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.
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, <https://docs.mathpix.com/#request-parameters>, as shown
> below:
>
> curl -X POST https://api.mathpix.com/v3/text \
> -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://127.0.0.1:18888 -X POST
> https://api.mathpix.com/v3/latex -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. ----------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2021-06-09