2013-12-11 72 views

回答

2

這是元數據,它有助於數據消費者瞭解如何解釋此鏈接。一個文件通常是一組有限的數據,您可以下載。如果API根據請求提供數據,則每種API的格式和語法可能會有很大不同。

對於CKAN本身來說,它並不是一個指向文件或API的鏈接。正如你在下面的例子中看到的,對於API和文件,下載鏈接是不同的。所述CKAN API的結果示出了不同resource_typeapifile.upload):

API: API Endpoint

API (Vici.org Search API)

{ 
    resource_group_id: "904ef692-6172-4173-92ec-3363aefcd599", 
    cache_last_updated: null, 
    revision_timestamp: "2012-09-25T14:38:05.040756", 
    webstore_last_updated: null, 
    id: "9060cf57-a1b1-4d32-8411-6ebfe6f8923b", 
    size: null, 
    state: "active", 
    hash: "", 
    description: "If called without any parameter, the API returns all markers in Geo-JSON format. This call can be demanding on the server so try not to do this call more than once. If you want to build your own services on the Vici.org data, please use the following call: http://vici.org/points.php?bounds=38.0,-7.0,40.0,-5.0&zoom=11 This call only return the markers for the area defined by two corners of 'bounds' (latitude, longitude of south-west point, latitude, longitude of north-east point). The higher the value of 'zoom', the more 'detail' markers are returned.", 
    format: "JSON", 
    tracking_summary: { 
     total: 0, 
     recent: 0 
    }, 
    mimetype_inner: "", 
    mimetype: "application/json", 
    cache_url: "", 
    name: "Search API", 
    created: "2012-09-25T09:35:54.519845", 
    url: "http://vici.org/points.php", 
    webstore_url: "", 
    last_modified: "2012-09-25T09:35:56.933638", 
    position: 0, 
    revision_id: "92cc4b1c-bc1f-4fc4-8d45-54f342b7d617", 
    resource_type: "api" 
} 

文件: Download and preview file

File (Wikipedia new user registration)

{ 
    resource_group_id: "59423860-c694-413f-bd8c-53e4aba75d38", 
    cache_last_updated: null, 
    revision_timestamp: "2012-05-09T21:56:11.096290", 
    webstore_last_updated: null, 
    owner: "c349ab48-4ac5-482d-bd5c-d3c7501e65aa", 
    id: "0064af74-6877-4105-9098-5ccbddf68d33", 
    size: "312354", 
    cache_url_updated: "2012-05-09T21:51:12", 
    state: "active", 
    hash: "bb462573a0f0ef328dd989b9c0ee0c9072b18f87", 
    description: "Hourly new user registrations to the English Wikipedia (2008-2011), timestamps are aligned to 2011 for easy year-to-year comparison.", 
    format: "CSV", 
    tracking_summary: { 
     total: 0, 
     recent: 0 
    }, 
    mimetype_inner: "", 
    mimetype: "text/csv", 
    cache_url: "", 
    name: "enwiki-hourly-registrations-2008-2011.csv", 
    created: "2012-05-09T21:53:23.820579", 
    url: "https://commondatastorage.googleapis.com/ckannet-storage/2012-05-09T215108/enwiki-hourly-registrations-2008-2011.csv", 
    webstore_url: "https://commondatastorage.googleapis.com/ckannet-storage/2012-05-09T215108/enwiki-hourly-registrations-2008-2011.csv", 
    last_modified: "2012-05-09T21:53:24.900960", 
    position: 0, 
    revision_id: "f777dc04-a041-436d-83dd-2f03df4c8e15", 
    resource_type: "file.upload" 
} 
3

'鏈接到文件'用於鏈接到實際數據文件的URL,例如,一個CSV文件。 '鏈接到API'意味着被用來鏈接到一個網頁,人們可以在這裏閱讀他們可用的一些數據API。

如果您提供指向實際文件的鏈接,例如CSV文件,那麼CKAN的datastorerdatapusher可以將該文件中的數據拖入CKAN的DataStore,然後DataStore的Data API將可用於該文件,並且數據預覽將起作用,就像您將文件直接上傳到CKAN一樣。即使您沒有DataStore或datastorer/datapusher,CKAN仍然可以使用DataProxy顯示該文件的預覽。

另一方面,如果您鏈​​接到API,所有用戶都可以做的就是點擊鏈接。

相關問題