Giter Club home page Giter Club logo

Comments (2)

ganeshkharad2 avatar ganeshkharad2 commented on July 30, 2024

"message": "Error page size + offset must be less than maxoffset: 10000"

from api.

jonquandt avatar jonquandt commented on July 30, 2024

@ganeshkharad2 - The API has a 10,000 item limit for the collections request, so if your count is higher than that, you should consider splitting your request range using both startDate and endDate.

https://github.com/usgpo/api#collection-update

The collections response is sorted by each package's lastModified value, starting with the newest first.

so, you could use:

https://api.govinfo.gov/collections/CHRG/1990-01-01T00:00:00Z/?offset=9899&pageSize=100&api_key=DEMO_KEY
to get the last value available there. The last item available for that request would be:

{
	"packageId": "CHRG-113hhrg86796",
	"lastModified": "2018-07-30T19:11:28Z",
	"packageLink": "https://api.govinfo.gov/packages/CHRG-113hhrg86796/summary",
	"docClass": "HHRG",
	"title": "Changes to the Height Act: Shaping Washington, D.c., for the Future, Part II",
	"congress": "113"
}

What I would recommend would be to construct the request to start with that one - you may need to slightly adjust to get only 10k results, as multiple packages may be published at the same time.

https://api.govinfo.gov/collections/CHRG/2018-07-30T19:12:28Z/?offset=0&pageSize=100&api_key=DEMO_KEY

which has 9831 results.

You could then use the startDate from the above as the endDate for a follow-on request.

https://api.govinfo.gov/collections/CHRG/2018-06-01T00:00:00Z/2018-07-30T19:12:28Z/?offset=0&pageSize=100&api_key=DEMO_KEY

Then you could do a further set of requests until you get to the total number of results. Based on the base collections request, there are 27858 total packages:

https://api.govinfo.gov/collections?api_key=DEMO_KEY

{
	"collectionCode": "CHRG",
	"collectionName": "Congressional Hearings",
	"packageCount": 27858,
	"granuleCount": 33
},

Alternatively, if you want to retrieve the full set of CHRG, you could use our sitemaps to identify all packages currently in the system, using the packageid as identified in the <loc> values.

https://www.govinfo.gov/sitemap/CHRG_sitemap_index.xml

https://www.govinfo.gov/sitemap/CHRG_2018_sitemap.xml

<url>
<loc>
https://www.govinfo.gov/app/details/CHRG-115jhrg28355
</loc>
<lastmod>2018-07-02T19:05:01.409Z</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.