所以我试图将一些信息添加到摄像机数据库中。执行此操作的方法(根据制作此数据库的人员)是使用Curl命令:
curl --header "Content-Type: application/json" --data "$DATA"
<cam2api_domain>/cameras/
其中“cam2api_domain”是数据库的url,“$ DATA”是摄像机信息。在观察了一个数据库条目之后:
[{"description":"Camera in Kenya recording lions","resolution_h":1080,"resolution_w":1920,"inactive":null,"traffic":null,"last_updated":"2017-10-31T01:48:28.427749Z","city":"Nairobi","state":"None","pk":1,"lng":36.8163,"lat":-1.2804,"retrieval_model":{"ip":"10.0.0.1","port":80},"source":"google","camera_type":"IP","camera_id":26065,"outdoors":null,"is_video":null,"date_added":"2017-10-31T01:48:28.427709Z","source_url":"www.google.com","country":"Kenya"}]
我开始尝试使用以下命令创建新条目:
正如您所见,我不断收到错误
{"detail":"JSON parse error - Expecting ',' delimiter: line 1 column 15 (char 14)"}
我无法确定此错误的原因,因为我被告知新的摄像机条目不需要指定所有字段(只需要我使用的那些字段)。我也尝试添加一个相机,每个字段都填写,但收到相同的结果。有谁知道为什么会这样?