[ckan-dev] Package modification date
David Read
david.read at okfn.org
Tue May 17 10:08:59 UTC 2011
2011/5/17 Adrià Mercader <amercadero at gmail.com>:
> Hi all,
>
> I'm working on the CKAN harvester, and I need to check when a package
> was last modified. I'm using the json API to get the remote packages.
> Two different questions here:
>
> * For an individual package, "metadata_modified" looks like the one to look at:
> http://it.ckan.net/api/2/rest/package/2eb938e1-0aa0-4a33-8e2b-d7d8f6b41101
Yes
> The thing is that it is not always present, like in this case:
> http://hu.ckan.net/api/2/rest/package/5f343aba-bef5-4f3f-abfd-672f2de1dbe0
hu.ckan.net is running v1.2a which doesn't have this feature, which
was added in v1.3 (ticket #806). So it (and no doubt some others) will
need to be upgraded.
> Should I fall back to the revision
> (http://hu.ckan.net/api/2/rest/revision/6fe1c323-2094-4955-887b-abee19ab4f28)
> to look at the last modified date in that case?
> For the packages that have "metadata_modified", is this equivalent to
> the revision timestamp?
They are related, but not the same. The metadata_modified is the last
modification date of any of the 'greater package' (includes tags,
extras, groups and resources), whereas the revision field has the most
recent revision of just the package (excluding tags etc).
This is a subtle point, and highlights a difficulty with our present
model/terminology.
> * If I wanted to query only the packages modified from a certain date,
> I guess I should use the revision search api:
> http://it.ckan.net/api/search/revision?since_time=2011-04-17
Yes this works. When you query each revision, it will tell you which
packages are related, including a package that you just edit an extra
field or resource of.
> My question is, are the revisions returned only referring to changes
> in packages, or there could be also changes in groups, users, etc on
> this list?
Yes that is correct. In this case, when you GET these revisions they
will have the "packages" field blank, so you can ignore these for your
purpose.
So in summary, it sounds like the revision search suits you over the
metadata_modified.
David
>
>
> Thanks!
>
> Adrià
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
>
More information about the ckan-dev
mailing list