How to Solve Curl pass large JSON files Error

Solutions to errors in curl passing large JSON files

Next, the shell first obtains the token, and then sends the JSON file to the server with the token,   After hours of normal JSON files, the following shell can run normally.

#!/bin/bash
#
access_res=$(curl "http://192.168.1.1:30100/api/v1/ability_sub/external/getToken?appId=d53e9b4083a8577e31dae685305fd032&secret=27766999
0d60d4616a8ae1fd9d6fc114")

access_token=$(echo $access_res |cut -d":" -f6 |cut -d"}" -f1|sed s/\"//g)

accress_url='curl -i -X POST -H "Content-Type:application/json" -d @/opt/accesstoken/test.json http://192.168.1.1:30202/app-l59q59yp3po2
7l-store/quality/faultOrderQ?'${access_token}

echo $accress_url
$accress_url

When using curl post data, if the post data is greater than 1024 bytes, curl will not directly initiate the post request. But in two steps.

1. Send a request. The header contains an expect: 100 continue to ask whether the server is willing to accept data

2. After receiving the 100 continue response returned by the server, post the data to the server.

By default, the server is enabled to receive JSON. In this case, the query before sending is removed and – H “expect:” is added, as follows:

accress_url='curl -i -X POST -H "Expect:" -H "Content-Type:application/json" -d @/opt/accesstoken/test.json http://192.168.1.1:30202/app-l59q59yp3po2 7l-store/quality/faultOrderQ?'${access_toke

In this way, you can add scheduled tasks

Similar Posts: