usgpo / api

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

Adding conditions to get requests #91

Open morden35 opened 3 years ago

morden35 commented 3 years ago

Hi there!

I would like to be able to add a condition to a Collections request. For example, I want to get all bills where 'climate' or 'Climate' is contained in the title. At the moment, I am doing this using python/regex after I request all bills for a given congress, however this method is limited by the 10,000 collections cap. Thank you in advance!

jonquandt commented 2 years ago

This is something we'd look to address with #1, which is rising higher in our priority list for development. No tentative dates for release currently.

jonquandt commented 1 year ago

@morden35 - following up on this older request. The Search service could provide this functionality, like so:

curl -X 'POST' \
  'https://api.govinfo.gov/search?api_key=DEMO_KEY' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "query": "title:climate collection:bills lastModified:range(2023-11-01T00:00:00Z,)",
  "pageSize": 100,
  "offsetMark": "*",
  "sorts": [
    {
      "field": "lastModified",
      "sortOrder": "DESC"
    }
  ]
}'