문제점 : POST 요청과 함께 일부 데이터를 보내는 동안 명령 줄 도구를 사용하여 로컬 호스트 서버를 말리는 작업이 작동하지 않습니다. 오류의 원인이 될 것으로 보인다 무엇WINDOWS RESTful 서비스의 cURL POST 명령 줄
: 일부 검색 내가 알아 낸 후 는
curl: (6) Could not resolve host: application; No data record of requested type
curl: (6) Could not resolve host: data goes here,; No data record of requested type
curl: (6) Could not resolve host: data2; No data record of requested type
curl: (3) [globbing] unmatched close brace/bracket at pos 16
복귀 데이터의
curl -i -X POST -H 'Content-Type: application/json' -d '{"data1": "data goes here", "data2": "data2 goes here"}' http:localhost/path/to/api
결과 같은 것을 상상 그 문제는 t에 사용 된 sintax가 될 수 없다. 그는 UNIX 셸에서 작동하므로 요청합니다.
Are you possibly using Windows? That so looks like a completely broken shell that doesn't properly deal with single-quotes vs double-quotes. I just tried that command line and it worked fine on my linux box. http://curl.haxx.se/mail/archive-2011-03/0066.html
나는 "\를 탈출"그 주변에 작업을 시도했지만 여전히
2.
3.
curl -i -X POST -H 'Content-Type: application/json' -d '{\"data1\": \"data goes here\", \"data2\": \"data2 goes here\"}' http: //localhost/path/to/api
을 그래서 작동하지 않았다 내가 포기 했어. 윈도우 POST에 전송 된 JSON 객체와 엉망으로 보인다curl -i -X POST -H 'Content-Type: application/json' -d '{\"data1\": \"data goes here\", \"data2\": \"data2 goes here\"}' http: //localhost/path/to/api
질문 제목에'[solved] '를 추가하지 마십시오. 질문에 대한 대답을 알아 냈다면 대답으로 게시해야합니다. –
@CodyGray 경고 주셔서 감사합니다. 내 포스트를 바로 잡을거야. – Lothre1
git이 컴퓨터에 설치되어있는 경우에는 curl에 git bash를 사용할 수 있습니다. 그것은 많은 두통을 저장합니다. –