Content Actions

NSW Sites

API

Working with the OpenGov NSW API

OpenGov NSW data and functionality are available via an open web API. This service provides additional options for agencies wishing to integrate OpenGov NSW with their own websites. It also means that external developers, and members of the public more broadly, can easily extract and use OpenGov NSW data.

Please note that OpenGov NSW content is licensed Attribution (CC BY) under the Creative Commons licensing system, unless otherwise indicated. Copyright resides with the State of New South Wales unless otherwise indicated.

The OpenGov NSW web API is being actively developed. Unfortunately this does mean that it may change over the coming months. On the positive side, we will be very receptive, and grateful, for any feedback or suggestions for improvements: opengov@records.nsw.gov.au

Search for publications

https://www.opengov.nsw.gov.au/search.xml?query=query term

Returns search results in the OpenSearch XML format (http://www.opensearch.org)

List all publications

https://www.opengov.nsw.gov.au/publication.json

Returns a JSON list of all publications on the site.

Information about publications comprises descriptive metadata and a list of publication files. Publication files are the sequence of files that make up a publication: while many publications are associated with just one file, others, including annual reports published in separate parts, have multiple files.

For example:

{
  "ID": 11305,
  "Title": "NSW Department of Commerce Annual Report 2007/08",
  "Agencies": [
    "NSW Department of Commerce"
  ],
  "Type": "Annual Report",
  "Date": "2008",
  "Publishers": [],
  "Keywords": [
    "annual reports"
  ],
  "Description": "",
  "Language": "English",
  "Coverage": "New South Wales",
  "Copyright": "State of New South Wales",
  "Files": [
    "https://www.opengov.nsw.gov.au/publication/12304",
    "https://www.opengov.nsw.gov.au/publication/12305",
    "https://www.opengov.nsw.gov.au/publication/12306",
    "https://www.opengov.nsw.gov.au/publication/12307",
    "https://www.opengov.nsw.gov.au/publication/12308",
    "https://www.opengov.nsw.gov.au/publication/12309",
    "https://www.opengov.nsw.gov.au/publication/12310",
    "https://www.opengov.nsw.gov.au/publication/12311"
  ]
}

List all publications created by a particular agency

https://www.opengov.nsw.gov.au/agency/Agency ID.json

Returns a JSON list of all publications created by a particular agency.

List all agencies

https://www.opengov.nsw.gov.au/agency.json

Returns a JSON list of all NSW government agencies with publications on the site.

Information includes agency ID, agency name, and, optionally, a link to the agency’s description in State Records NSW’s online catalogue.

Extract metadata for a particular publication file

https://www.opengov.nsw.gov.au/publication/Publication File ID.json

Returns a JSON object describing a publication. This information comprises descriptive metadata and a list of publication files.

Extract text for a particular publication file

https://www.opengov.nsw.gov.au/publication/Publication File ID.txt

Returns the extracted text contents of a publication file.

Return the pdf for a particular publication file

https://www.opengov.nsw.gov.au/publication/Publication File ID.pdf

Returns the publication file's pdf.