将base64编码数据传递到卷曲请求 - 错误:参数列表太长

发布于 2025-02-09 13:12:54 字数 920 浏览 2 评论 0原文

我正在尝试将带有基本编码数据的参数传递给卷曲请求。它抱怨参数列表太长,因为基本编码的字符串太长。根据其他帖子的响应,我尝试将内容存储在文件中,并尝试将文件作为参数传递。在那里,我遇到了一个错误:文件已损坏或格式不支持

这是我的两个请求看起来,就像

curl -v -i POST "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '<base64encoded_data>'}"

curl -v -i POST "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '@file.txt'}"

我将base64编码的数据放在文件中一样 - file_screenshot

任何帮助都将不胜感激。

I am trying to pass a parameter with base encoded data to a curl request. It complains about the argument list too long because the base encoded string is too long. Based on the responses from other posts, I tried to store the content in a file and tried passing the file as a parameter. There, I am getting an error: The file is corrupted or format is unsupported

Here is what both my requests looks like

curl -v -i POST "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '<base64encoded_data>'}"

curl -v -i POST "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '@file.txt'}"

I put the base64 encoded data in the file as is - file_screenshot

Any help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回旧景 2025-02-16 13:12:54

curl具有从文件中执行操作的能力。结帐以下行块。

curl -X POST -d @filename.txt "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '<base64encoded_data>'}"

curl -X POST -d @filename.txt "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '@file.txt'}"

这是否回答您的问题。

CURL has ability to perform POST operation from a file. Checkout the following line block.

curl -X POST -d @filename.txt "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '<base64encoded_data>'}"

curl -X POST -d @filename.txt "https://contoso.azure.com/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-06-30-preview" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: <key>" --data "{'base64Source': '@file.txt'}"

Does this answer the your question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文