2016-12-06 1 views
0

다음의 bash 코드를 사용하여 에 GeoJSON을 공급하려고합니다.인수 목록이 너무 김 - 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

관련 문제