Skip to content

CKAN API for Harvesting

Luke Campbell edited this page Nov 2, 2016 · 6 revisions

CKAN API for Harvesting

Create a new harvest job

curl -XPOST -d '{"source_id": "7045f125-6b59-4a1a-ae6f-bda8e2e47904"}' -H 'Content-Type: application/json' -H 'Authorization: <api-key>' "http://<ckan_host>/api/3/action/harvest_job_create"

Harvest Show

curl -XGET "http://<ckan_host>/api/3/action/harvest_source_show?id=cencoos-waf" -s
{
    "help": "http://159b79a84c0d/api/3/action/help_show?name=harvest_source_show",
    "result": {
        "active": true,
        "config": "",
        "creator_user_id": "96f86843-80f5-40d6-ad8e-b6f01c59aaa8",
        "frequency": "MANUAL",
        "groups": [],
        "id": "d80ab373-5793-49f3-aa17-f53727d1ccdc",
        "metadata_created": "2016-09-07T17:07:32.381674",
        "metadata_modified": "2016-09-07T17:07:32.381682",
        "name": "gcoos-waf",
        "notes": "",
        "organization": {
            "approval_status": "approved",
            "created": "2016-09-07T15:05:07.985077",
            "description": "",
            "id": "3502bfdf-117c-45b7-80f7-9775ef1bde12",
            "image_url": "",
            "is_organization": true,
            "name": "gcoos",
            "revision_id": "8cd50585-cd3c-48eb-8762-5bba8300bb77",
            "state": "active",
            "title": "GCOOS",
            "type": "organization"
        },
        "owner_org": "3502bfdf-117c-45b7-80f7-9775ef1bde12",
        "private": false,
        "relationships_as_object": [],
        "relationships_as_subject": [],
        "resources": [],
        "revision_id": "5d11f973-1354-4215-90bb-b4851ac8fbd4",
        "source_type": "waf",
        "state": "active",
        "status": {
            "job_count": 2,
            "last_job": {
                "created": "2016-09-30 13:36:03.859280",
                "finished": "2016-09-30 13:36:04.223254",
                "gather_error_summary": [],
                "gather_finished": "2016-09-30 13:36:03.978278",
                "gather_started": "2016-09-30 13:36:03.918002",
                "id": "9f2a02f3-1562-4766-9d91-aa2cbfe68c93",
                "object_error_summary": [
                    {
                        "error_count": 4,
                        "message": "Element '{http://www.isotc211.org/2005/gco}Measure': '' is not a valid value of the atomic type 'xs:double'."
                    }
                ],
                "source_id": "d80ab373-5793-49f3-aa17-f53727d1ccdc",
                "stats": {
                    "added": 0,
                    "deleted": 0,
                    "errored": 4,
                    "not modified": 0,
                    "updated": 0
                },
                "status": "Finished"
            },
            "total_datasets": 0
        },
        "tags": [],
        "title": "GCOOS WAF",
        "type": "harvest",
        "url": "http://192.168.99.100:3001/GCOOS/"
    },
    "success": true
}

Job Report

curl -H "Authorization: <api-key>" -XGET "http://<ckan_url>/api/3/action/harvest_job_report?id=9f2a02f3-1562-4766-9d91-aa2cbfe68c93" -s
{
    "help": "http://159b79a84c0d/api/3/action/help_show?name=harvest_job_report",
    "result": {
        "gather_errors": [],
        "object_errors": {
            "31894581-e0b8-4151-9c22-8b943f71d86c": {
                "errors": [
                    {
                        "line": 103,
                        "message": "Element '{http://www.isotc211.org/2005/gco}Measure': '' is not a valid value of the atomic type 'xs:double'.",
                        "type": "Validation"
                    }
                ],
                "guid": "cbf5e2aacaa0a8ecf35c15dafd444bcd",
                "original_url": "http://192.168.99.100:3001/GCOOS/CONUS_12km_2012_TwoD.xml"
            },
            "a1c5468e-f858-467b-833d-13cb8b6f6b22": {
                "errors": [
                    {
                        "line": 103,
                        "message": "Element '{http://www.isotc211.org/2005/gco}Measure': '' is not a valid value of the atomic type 'xs:double'.",
                        "type": "Validation"
                    }
                ],
                "guid": "9c1462c8f960e643437c8e5f40d7d847",
                "original_url": "http://192.168.99.100:3001/GCOOS/CONUS_12km_2013_TwoD.xml"
            },
            "a2a755f7-5ea5-4fb0-810e-ae6a9bd4ea9d": {
                "errors": [
                    {
                        "line": 103,
                        "message": "Element '{http://www.isotc211.org/2005/gco}Measure': '' is not a valid value of the atomic type 'xs:double'.",
                        "type": "Validation"
                    }
                ],
                "guid": "ea99f90649876189dbdf690c508f91cc",
                "original_url": "http://192.168.99.100:3001/GCOOS/CONUS_12km_2013_Best.xml"
            },
            "e6f789a5-00be-41dc-954c-51b23670c3a1": {
                "errors": [
                    {
                        "line": 103,
                        "message": "Element '{http://www.isotc211.org/2005/gco}Measure': '' is not a valid value of the atomic type 'xs:double'.",
                        "type": "Validation"
                    }
                ],
                "guid": "2887aa1c7a9a340ff816637e78a1f129",
                "original_url": "http://192.168.99.100:3001/GCOOS/CONUS_12km_2012_Best.xml"
            }
        }
    },
    "success": true
}

References