Skip to content Skip to Quick Links

Introduction

The Bills Database contains key dates and the amendment history of some 6 000 Bills considered by the Council since 1906. The Database keeps track of the passage of a Bill such as its gazette date, dates of the three readings, formation and report of the corresponding Bills Committee, if any, and its discussions in Council meetings.

The information can be obtained in the form of open data via web application programming interface (API) as described in this page.

Please note that this is a beta version. Any comments are welcomed (please e-mail to pid@legco.gov.hk).


Web Application Programming Interface (API)

Note:
  1. For Internet Explorer users, please uncheck "Turn on feed reading view" in the "Settings" of the "Feed and Web slices" section under the "Content" tab of the Internet Options, and then re-start the browser in order to view data in XML format.
  2. Some browsers such as the Internet Explorer will download the data in JSON format instead of displaying them in the browsers. If you encounter such a case, you may download the file and open it with a text editor, or try to use some other browsers such as Chrome.
  3. When Chinese characters are used in a web api command, please perform URL encoding for it first, or use a browser such as Chrome that can encode Chinese characters automatically.
  4. The following commands will return the whole set of data and the total size is over 15MB. You may need to wait for some time (depending on the network speed).

The open data web api can be run at:

http://app.legco.gov.hk/BillsDB/odata/Vbills (JSON format)
http://app.legco.gov.hk/BillsDB/odata/Vbills?$format=xml (XML format)

To get the meta data schema of the dataset, please run the following:

http://app.legco.gov.hk/BillsDB/odata/$metadata

The following query string options can be applied:

  • $format - specify whether the data to be returned in json or xml format, e.g. $format=json
  • $top=N - select only the first N entries of the set, where N is a positive integer, e.g. $top=10
  • $skip=N - select only the remaining entries (starting with Entry N+1) where N is a positive integer, e.g. $skip=10
  • $orderby - what values are used to order the retrieved data, e.g. $orderby=bill_title_eng
  • $select - select specific fields to be returned, e.g. $select=bill_title_eng,bill_title_chi,bill_gazette_date
  • $filter - select specific entries according to provided conditions, e.g. $filter=year(bill_gazette_date) eq 2013
  • $inlinecount - specify "$inlinecount=allpages" to include the total number of records in the returned data

For the available operators and functions to be used with $filter option, please refer to the documentation of the Open Data Protocol.


Examples

The following examples illustrate some of the ways to retrieve data according to the Open Data Protocol.