我正在针对demo.ckan.org
执行以下upsert操作,但我收到了500条错误消息响应:
$ curl -X POST "http://demo.ckan.org/api/3/action/datastore_upsert" \
-H "Authorization: my-api-key-is-private" \
-d '{
"resource_id": "f5091a4f-bf07-42cf-8323-30ce7110d981",
"records": [
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.140Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 0,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "0"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.241Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 1,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": ".50"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.285Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 2,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "1.00"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.328Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 3,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "1.50"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.379Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 4,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "2.00"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.424Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 5,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "2.50"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.474Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 6,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "3.00"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.522Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 7,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "3.50"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.566Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 8,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "4.00"
}
]
},
{
"recvTimeTs": "1447168892",
"recvTime": "2015-11-10T15:21:32.620Z",
"entityId": "Room1",
"entityType": "Room",
"attrName": "temperature",
"attrType": "centigrade",
"attrValue": 9,
"attrMd": [
{
"name": "resolution",
"type": "integer",
"value": "4.50"
}
]
}
],
"method": "insert",
"force": "true"
}'
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
[no address given] and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at demo.ckan.org Port 80</address>
</body></html>
有什么想法吗?我已经用单个记录列表进行了测试,如果问题是关于paylaod的大小(无论如何,10条记录对我而言似乎是“光”),但问题是一样的。我在请求中遗漏了什么吗?如您所见,资源存在:
答案 0 :(得分:1)
根据demo.ckan.org,attrValue是一个json列(CKAN API Call)。
看起来您正在尝试将整数值插入到“attrValue”列中,这些列不是有效的json。当然,如果这不会导致内部服务器错误,那将是很好的;最好在https://github.com/ckan/ckan/issues提交问题。