2016-12-06 7 views
0

このdata serviceにGeoJSONをフィードしようとしましたが、次のbashコードを使用しています。引数リストが長すぎます - Curl - GeoJSON

curl -X POST -F "shape=$(cat myfile.geojson)" \ 
-F 'age=69' -o reconstructed_myfile.geojson \ 
https://dev.macrostrat.org/reconstruct 

ただし、「引数リストが長すぎます」というエラーが表示されています。私はこの問題に関連してスタック上で多くの質問を見ていますが、これらのスレッドで与えられた答えをこの特定のケースに変換する方法を理解していません。

答えて

4

あなたは<filenameまたは@filenameを使用する必要があります。

curl -X POST \ 
    -F 'shape=<myfile.geojson' \ 
    -F 'age=69' \ 
    -o 'reconstructed_myfile.geojson' \ 
    -- 'https://dev.macrostrat.org/reconstruct' 

は詳細についてはman curlを参照してください:

$ man curl | awk '$1 ~ /-F/' RS= 
    -F, --form <name=content> 
      (HTTP) This lets curl emulate a filled-in form in which a user has 
      pressed the submit button. This causes curl to POST data using the 
      Content-Type multi‐ part/form-data according to RFC 2388. This 
      enables uploading of binary files etc. To force the 'content' part to 
      be a file, prefix the file name with an @ sign. To just get the 
      content part from a file, prefix the file name with the symbol <. The 
      difference between @ and < is then that @ makes a file get 
      attached in the post as a file upload, while the < makes a text field 
      and just get the contents for that text field from a file. 
+0

は '<'ここに '@'よりも適切ではないでしょうか? – chepner

+0

はい、 '<'は私にとってより意味があります。残念ながら、私はGeoJSONとして500の内部サービスエラーを返します。これは、Curlビットではなくデータサービス側の問題を示唆するかもしれませんが、データサービスは元の構文を使用してより小さなファイルで動作します。 – Andy

関連する問題