MyTetra Share
Делитесь знаниями!
How to pass payload via JSON file for curl?
Время создания: 02.02.2018 11:38
Текстовые метки: curl post json
Раздел: cURL, wget
Запись: Velonski/mytetra-database/master/base/1517553480shecowvkgs/text.html на

curl sends POST requests with the default content type of application/x-www-form-urlencoded. If you want to send a json request, you will have to specify the correct content type header:

$ curl -vX POST http://server/api/v1/places.json -d @testplace.json \

--header "Content-Type: application/json"

But that will only work if the server accepts json input. The .json at the end of the url may only indicate that the output is json, it doesn't necessarily mean that it also will handle json input. The API documentation should give you a hint wheather it does or not.

The reason why you get a 401 and not some other error is probably because the server can't extract the auth_token from your request.

shareimprove this answer

edited Sep 4 '13 at 13:00

answered Sep 4 '13 at 12:54



MyTetra Share v.0.62
Яндекс индекс цитирования