Comments (1)
@cnizzardini - the first request is failing because CREC packages (and granules) do not have an XML representation of the content. The API is handling your request for an XML of the content and the server is returning our standard 404 for content that doesn't exist. You may want to add the -L switch to your curl request so that your request follows internal server redirects:
$ curl -L -X GET "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/xml?api_key=DEMO_KEY" -H "accept: /"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 235 100 235 0 0 203 0 0:00:01 0:00:01 --:--:-- 209
100 182 100 182 0 0 147 0 0:00:01 0:00:01 --:--:-- 147
100 123 0 123 0 0 89 0 --:--:-- 0:00:01 --:--:-- 89
{"timestamp":1542519554946,"status":404,"error":"Not Found","message":"No message available","path":"/govinfoapi/content/"}
Your options for content download for the granule you're looking for is available via the summary endpoint. e.g.:
curl -X GET "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/summary?api_key=DEMO_KEY" -H "accept: /"
{"title":"Daily Digest/House of Representatives","collectionCode":"CREC","collectionName":"Congressional Record","category":"Proceedings of Congress and General Congressional Publications","dateIssued":"2018-01-04","detailsLink":"https://www.govinfo.gov/app/details/CREC-2018-01-04/CREC-2018-01-04-pt1-PgD7-3","granulesLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/granules?offset=0&pageSize=100","packageId":"CREC-2018-01-04","packageLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/summary","granuleId":"CREC-2018-01-04-pt1-PgD7-3","download":{"txtLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/htm","pdfLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/pdf","modsLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/mods","premisLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/premis","zipLink":"https://api.govinfo.gov/packages/CREC-2018-01-04/zip"},"bookNumber":"1","granuleClass":"DAILYDIGEST","subGranuleClass":"DDHCHAMBER","granuleDate":"2018-01-04","pagePrefix":"D","lastModified":"2018-07-31T12:43:00Z"}
The download section in the summary shows:
"download": {
"txtLink": "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/htm",
"pdfLink": "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/pdf",
"modsLink": "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/mods",
"premisLink": "https://api.govinfo.gov/packages/CREC-2018-01-04/premis",
"zipLink": "https://api.govinfo.gov/packages/CREC-2018-01-04/zip"
}
MODS and PREMIS present descriptive and preservation metadata about the content in xml format.
You'll see that performing a request for the htm rendition does return content as expected in curl:
$ curl -X GET "https://api.govinfo.gov/packages/CREC-2018-01-04/granules/CREC-2018-01-04-pt1-PgD7-3/htm?api_key=DEMO_KEY" -H "accept: /"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 566 100 566 0 0 412 0 0:00:01 0:00:01 --:--:-- 483
<html>
<head>
<title>Congressional Record, Volume 164 Issue 2 (Thursday, January 4, 2018)</title>
</head>
<body><pre>
[Congressional Record Volume 164, Number 2 (Thursday, January 4, 2018)]
[Daily Digest]
[Page D7]
From the Congressional Record Online through the Government Publishing Office [<a href="http://www.gpo.gov">www.gpo.gov</a>]
House of Representatives
Chamber Action
The House was not in session today. The House is scheduled to meet in
a Pro Forma session at 12 noon on Friday, January 5, 2018.
</pre></body>
</html>
The API documentation page isn't really intended for curling in that manner -- since that /docs is a page that then fires off several requests to serve the swagger.json file in a (human) user-friendly manner
You could also just request the swagger.json directly via https://api.govinfo.gov/swagger.json
I hope that helps.
from api.
Related Issues (20)
- WayOut HOT 1
- Packages - set default granulesLink pagination to use offsetMark
- Related - CPRT to CPRT relationships
- Missing Bill Text XML for BILLS-118hr3571ih and BILLS-118hres383eh HOT 8
- Anti Virus software update
- Hello would My dreams officiall Pakistan off world now technologie ❓️
- Brian j Reinwald HOT 1
- Reinwald Brian
- Brian j Reinwald
- Search - new tab generated from /docs page returns error
- Search - add relatedLink to Search Service results
- need to add upcoming feature HOT 1
- Govinfo API key HOT 6
- 401 Errors HOT 8
- Smartscriptmatrix
- Retrieve CREC documents which have the property "Congress Member Speaking" HOT 1
- Receive "HTTP Error 401: Unauthorized" after 100 scrapes HOT 1
- abdulrahmannabhan HOT 4
- Bulk data API back to 103rd Congress HOT 6
- Missing Bill Text for S3621 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api.