gpt4 book ai didi

ckan - 无法通过 API 在 demo.ckan.org 中创建资源(500 错误)

转载 作者:行者123 更新时间:2023-12-05 00:55:52 25 4
gpt4 key购买 nike

我正在使用 demo.ckan.org 进行一些测试,它正在运行 API 的 2.4 版本,AFAIK。除了资源创建之外,一切都运行良好(组织和数据集创建)。 resource_create 方法始终返回 500 错误。

这是 curl 显示我要在其中创建资源的包:

$ curl -X GET "http://demo.ckan.org:80/api/3/action/package_show?id=f2c4125b-27c8-4e07-94d7-d6d0c0b65154" | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1228 100 1228 0 0 1384 0 --:--:-- --:--:-- --:--:-- 1386
{
"help": "http://demo.ckan.org/api/3/action/help_show?name=package_show",
"result": {
"author": null,
"author_email": null,
"creator_user_id": "b0a12b23-4cee-4d8c-993e-723421a0a296",
"extras": [],
"groups": [],
"id": "f2c4125b-27c8-4e07-94d7-d6d0c0b65154",
"isopen": false,
"license_id": null,
"license_title": null,
"maintainer": null,
"maintainer_email": null,
"metadata_created": "2015-09-29T14:09:21.629953",
"metadata_modified": "2015-09-29T14:09:21.669256",
"name": "frb_org_test1_frb_pkg_test2",
"notes": null,
"num_resources": 0,
"num_tags": 0,
"organization": {
"approval_status": "approved",
"created": "2015-09-29T10:55:53.479724",
"description": "",
"id": "402f83c1-0070-4694-a1d9-f25b1d114631",
"image_url": "",
"is_organization": true,
"name": "frb_org_test1",
"revision_id": "26993878-9024-429a-b753-cc087b0ce382",
"state": "active",
"title": "",
"type": "organization"
},
"owner_org": "402f83c1-0070-4694-a1d9-f25b1d114631",
"private": false,
"relationships_as_object": [],
"relationships_as_subject": [],
"resources": [],
"revision_id": "47acfd70-8d26-4ebb-8cbd-6cababc627b1",
"state": "active",
"tags": [],
"title": "frb_org_test1_frb_pkg_test2",
"type": "dataset",
"url": null,
"version": null
},
"success": true
}

curl 在尝试创建资源时失败:

$ curl -X POST "http://demo.ckan.org:80/api/3/action/resource_create" -d '{ "name": "room1_room", "url": "none", "package_id": "f2c4125b-27c8-4e07-94d7-d6d0c0b65154" }' -H "Authorization: MY_API_KEY_IS_SECRET"
<!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>

最佳答案

这似乎是一个文档(和代码)错误。

虽然格式在文档中被标记为可选,但代码要求它存在(不幸的是,如果它不存在,将会崩溃)。

我已经在 https://github.com/ckan/ckan/issues/2665 创建了一个工单

作为解决此问题之前的临时措施,您可以在发送的 JSON 中指定“格式”(可以为空)。

关于ckan - 无法通过 API 在 demo.ckan.org 中创建资源(500 错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32860432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com