我一直在想为什么我现在不能运行这段代码。
curl -X POST '<a href="http://tp-api.herokuapp.com/beacons/" rel="nofollow">tp-api-server.herokuapp.com/beacons</a>' -H 'Content-Type: application/json' -d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}'
输出:
curl:(3(URL使用错误/非法格式或缺少URL
将不胜感激
不能只在命令中放置HTML锚链接。删除此项并将URL放在命令末尾:
curl -X POST
-H 'Content-Type: application/json'
-d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}'
http://tp-api.herokuapp.com/beacons/
一个衬垫:
curl -X POST -H 'Content-Type: application/json' -d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}' http://tp-api.herokuapp.com/beacons/
试试这个:
curl -X POST 'http://tp-api.herokuapp.com/beacons/' -H 'Content-Type: application/json' -d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}'
"a"标签没有意义
我检查了URL"tp-api-server.herokuapp.com/beacons",但它没有任何您在帖子请求中提到的"id"键。
试试这个,{"beacons":{"a":[10,0],"b":[0,10],"c":[0]}}