Reputation: 3798
I'm performing the following upsert operation against demo.ckan.org
but I'm receiving a 500 error message response:
$ 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>
Any ideas? I've tested with a single record list, if the problem was about the size of the paylaod (anyway, 10 records seem to me as something "light"), but the problem is the same. Am I missing something in the request? As you can see, the resource exists:
Upvotes: 2
Views: 188
Reputation: 535
According to demo.ckan.org, attrValue is a json column (CKAN API Call).
It looks like you are trying to insert integer values into that column "attrValue", which are not valid json. Of course it would be nice if this didn't cause an internal server error; would be good to file an issue at https://github.com/ckan/ckan/issues.
Upvotes: 1