Skip to content

DataStore API strips site name from resource URL #3189

Description

@creg-ny-baa

On CKAN version 2.5.2 installed from package:

When creating a DataStore resource via API, the URL of the resource does not start with the site name as given in the config. (Example below.) This results in the "Download resource" button not being available. (It gets tucked away in a div named "data-viewer-error js-hide".) Note that I do not use the DataPusher extension.

Here is a clip of the JSON dictionary passed to the datastore_create API:

{
    "resource":{
        "package_id":"qalert-historical-requests", 
        "name":"QAlert Requests for 2013"
        },
    "force": true,
    "fields": [
        {"id": "id", "type": "int"},
        {"id": "status", "type": "int"},
        {"id": "createDate", "type": "timestamp"},
        ...
        ],
    "primary_key":"id"
}

Here is the result from the API call to resource_show:

{
  "help": "http://10.10.1.97/api/3/action/help_show?name=resource_show",
  "success": true,
  "result": {
    "cache_last_updated": null,
    "package_id": "a160881f-77e5-4de0-bcc1-2e8c76eaec48",
    "webstore_last_updated": null,
    "datastore_active": true,
    "id": "df0772e9-032b-4a12-bda4-92ec1ba5b806",
    "size": null,
    "state": "active",
    "hash": "",
    "description": "",
    "format": "",
    "last_modified": null,
    "url_type": "datastore",
    "mimetype": null,
    "cache_url": null,
    "name": "QAlert Requests for 2014",
    "created": "2016-08-03T07:54:44.576971",
    "url": "/datastore/dump/df0772e9-032b-4a12-bda4-92ec1ba5b806",
    "webstore_url": null,
    "mimetype_inner": null,
    "position": 1,
    "revision_id": "ad74b8ea-7d98-465d-9444-e0158d24acf7",
    "resource_type": null
  }
}

You can see that the "url" value is missing the site name. I think we can rule out a config issue because the issue does not show up on uploaded data, or anywhere else for that matter.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions