govinfo-link-js
Access U.S. Government Publishing Office's FDsys (Federal Digital System) content and metadata collections using the
govinfo-link-js
client for Node.js and Web browsers.
Table of contents
1. Install
1.1. For Node.js environments
Download and install Node.js (and its package manager, npm), if you don't have them, already.
1.1.1. Using npm
To publish the library as a npm , please follow the procedure in "Publishing npm packages ."
Then install it via:
npm install govinfo-link-js --save
1.1.2. Using git
If the library is hosted at a git repository, e.g. https://github.com/democracy-ia/govinfo-link-js then install it via:
npm install democracy-ia/govinfo-link-js --save
Designers and developers: additional installation instructions
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
Finally, switch to the directory you want to use your govinfo-link-js from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
You should now be able to require('govinfo-link-js')
in javascript files from the directory you ran the last command above from.
1.2. For browsers
The library also works in the browser environment via npm and browserify . After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
1.3. Webpack configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: rules: parser: amd: false
2. Usage
View all
govinfo-link-js
API references (with usage examples).
const CodeOfFederalRegulations = const api = // {Number} Title numberconst titlenum = 3 // {String} Part number.const partnum = '100' const opts = /** * @prop * If section number is not provided the entire part will be returned. */ sectionnum: null /** * @prop * If year is not provided, the most recent version of the CFR section * or part is returned. Default is most recent. */ year: '2011' /** * @prop {string=pdf} [linkType] - This is the format of the returned * document. Default is pdf. Other values are xml, mods, premis, * details, context, related. */ linkType: 'xml' api
3. API
The link service is used to create embedded links to content and metadata on govinfo and is currently enabled for the collections below. More information about each query, including examples, is provided on each collection page.
3.1. Models
-
CodeOfFederalRegulations
: Code of Federal Regulations -
CompilationOfPresidentialDocuments
: Compilation of Presidential Documents -
CongressionalBills
: Congressional Bills -
CongressionalCalendars
: Congressional Calendars -
CongressionalCommitteePrints
: Congressional Committee Prints -
CongressionalDocuments
: Congressional Documents -
CongressionalHearings
: Congressional Hearings -
CongressionalRecordDaily
: Congressional Record Daily -
CongressionalReports
: Congressional Reports -
FederalRegister
: Federal Register -
PublicAndPrivateLaws
: Public and Private Laws -
StatutesAtLarge
: Statutes at Large -
UnitedStatesCode
: United States Code
3.2. Endpoints
All HTTP request URIs are relative to https://www.govinfo.gov/link.
Class | Method | HTTP request |
---|---|---|
govinfo. CodeOfFederalRegulations | cfrFetchUsingGET |
GET /cfr/{titlenum}/{partnum} Parameters: title number, part number, section number, year OR most recent |
govinfo. CompilationOfPresidentialDocuments | cpdDcpdFetchUsingGET |
GET /cpd/{year} Parameters: dcpd type OR dcpd number |
govinfo. CompilationOfPresidentialDocuments | cpdFetchUsingGET |
GET /cpd/{doctype}/{docnum} Parameters: document type, document number |
govinfo. CongressionalBills | billsFetchUsingGET |
GET /bills/{congress}/{billtype}/{billnum} Parameters: bill number, bill type, congress, bill version OR most recent |
govinfo. CongressionalCalendars | ccalFetchUsingGET |
GET /ccal/{chamber}/{section} Parameters: chamber, section, publish date OR most recent |
govinfo. CongressionalCommitteePrints | cprtHouseFetchUsingGET |
GET /cprt/{congress}/house/{printnum}/{committee} Parameters: congress, chamber, house print number, committee |
govinfo. CongressionalCommitteePrints | cprtJacketFetchUsingGET |
GET /cprt/{congress}/{jacketid} Parameters: congress, jacket number |
govinfo. CongressionalCommitteePrints | cprtSenateFetchUsingGET |
GET /cprt/{congress}/senate/{printnum} Parameters: congress, chamber, senate print number |
govinfo. CongressionalDocuments | cdocFetchUsingGET |
GET /cdoc/{congress}/{doctype}/{docnum} Parameters: congress, document type, document number |
govinfo. CongressionalDocuments | cdocJacketFetchUsingGET |
GET /cdoc/{congress}/{jacketid} Parameters: congress, jacket number |
govinfo. CongressionalHearings | chrgHouseFetchUsingGET |
GET /chrg/{congress}/house/{committee}/{serialnumber} Parameters: congress, chamber, committee, house serial number |
govinfo. CongressionalHearings | chrgJacketFetchUsingGET |
GET /chrg/{congress}/{jacketid} Parameters: congress, jacket number |
govinfo. CongressionalHearings | chrgSenateFetchUsingGET |
GET /chrg/{congress}/senate/{hearingnumber} Parameters: congress, chamber, senate hearing number |
govinfo. CongressionalRecordDaily | crecSectionFetchUsingGET |
GET /crec/section/{section} Parameters: section, publish date OR most recent |
govinfo. CongressionalRecordDaily | crecTypeFetchUsingGET |
GET /crec/cas/{congress}/{billtype}/{billnum} Parameters: congress, bill number, bill type |
govinfo. CongressionalRecordDaily | crecTypeFetchUsingGET1 |
GET /crec/type/{type} Parameters: document type, publish date OR most recent |
govinfo. CongressionalRecordDaily | crecVolumeFetchUsingGET |
GET /crec/{volume}/{pageprefix}/{page} Parameters: volume, page prefix, page number |
govinfo. CongressionalReports | crptBillFetchUsingGET |
GET /crpt/{congress}/{associatedbillnum} Parameters: associated bill, congress |
govinfo. CongressionalReports | crptReportFetchUsingGET |
GET /crpt/{congress}/{doctype}/{reportnum} Parameters: congress, report type, report number |
govinfo. FederalRegister | frDocFetchUsingGET |
GET /fr/{frdocnum} Parameters: Federal Register document number |
govinfo. FederalRegister | frVolumeFetchUsingGET |
GET /fr/{volume}/{page} Parameters: volume, page number |
govinfo. PublicAndPrivateLaws | plawBillFetchUsingGET |
GET /plaw/{congress}/{associatedbillnum} Parameters: associated bill number, congress |
govinfo. PublicAndPrivateLaws | plawStatuteFetchUsingGET |
GET /plaw/{statutecitation} Parameters: Statutes at Large citation |
govinfo. PublicAndPrivateLaws | plawTypeFetchUsingGET |
GET /plaw/{congress}/{lawtype}/{lawnum} Parameters: congress, law type, law number |
govinfo. StatutesAtLarge | statuteTypeFetchUsingGET |
GET /statute/{congress}/{lawtype}/{lawnum} Parameters: congress, law type, law number |
govinfo. StatutesAtLarge | statuteVolumeFetchUsingGET |
GET /statute/{volume}/{page} Parameters: volume, page number |
govinfo. UnitedStatesCode | uscodeFetchUsingGET |
GET /uscode/{title}/{section} Parameters: title number, type, section, year OR most recent |
4. Contribute
We welcome contributions with GitHub issues and pull requests.
Contributions in the form of GitHub pull requests are welcome. Before embarking on a significant change, please adhere to the following guidelines:
-
Create an issue—e.g., a defect ("bug") report or a feature request—to propose changes.
Exceptions:
If you're working on documentation and fixing something simple like a typo or an easy bug, go ahead and make a pull request.
-
Follow the CONTRIBUTING guidelines.
Why:
Standards and guidelines make communication easier. If you're willing and able to program—or want to learn how— following the guidelines will increase the likelihood of adding your changes to the software product.
-
Why:
It's more fun when everybody's friendly and respectful.
-
Make a pull request when you're ready for other to review your changes (or you get stuck somewhere).
PR novices:
🙋 Never created a pull request? No problem. 🆓 Take this free online training . (It even covers most of the conventions in the CONTRIBUTING guidelines!)