usgpo / api

services to access govinfo content and metadata
https://api.govinfo.gov
Other
184 stars 58 forks source link

GET Collections (CFR) within Date Range always returns empty results #94

Closed calwi closed 2 years ago

calwi commented 2 years ago
https://api.govinfo.gov/collections/CFR/2018-12-01T00%3A00%3A00Z/2021-12-01T00%3A00%3A00Z?offset=0&pageSize=100&api_key=<API_KEY>

Surely this should return some data. It returns the following. Tried multiple Date configurations. Always the same.

{
  "count": 0,
  "message": "No results found",
  "nextPage": null,
  "previousPage": null,
  "packages": []
}
jonquandt commented 2 years ago

@calwi -- The collections endpoint returns results based on the last time that those packages were edited or updated within govinfo, similar to what you'd see within a sitemap. From time to time, we reprocess our collections, often to extract additional metadata or make other improvements.

You can see that this is working by omitting the lastModifiedendDate parameter: https://api.govinfo.gov/collections/CFR/2018-12-01T00%3A00%3A00Z?offset=0&pageSize=100&api_key=DEMO_KEY which returns 5593 results.

If you are interested in the CFRs that had issue dates in 2018-2021, I would suggest that you look at using the published endpoint.

e.g.

https://api.govinfo.gov/published/2018-01-01/2021-12-31?pageSize=100&offset=0&collection=CFR&api_key=DEMO_KEY

You can also add a modifiedSince parameter to see only packages that were published/updated since that time. This example shows the pakages with issue dates of 2018-2021 that have been added or modified since the beginning of March 2022.

https://api.govinfo.gov/published/2018-01-01/2021-12-31?pageSize=100&offset=0&collection=CFR&modifiedSince=2022-03-01T00:00:00Z&api_key=DEMO_KEY

calwi commented 2 years ago

Ahh, OK. Thank you. I'll have a look at those instead. I had thought that was what the former endpoint would do maybe, my mistake.