Skip to content

City of Toronto Beach Water Quality API document

Mikaal Naik edited this page Jun 26, 2020 · 1 revision

Open Data Dataset: Toronto Beaches Water Quality

Owner Public Health - Healthy Environments Program

XML versions available: 1.0 Data  1. Most recent daily report for all beaches: 
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches.xml?v=%3cversion"http://app.toronto.ca/tpha/ws/beaches.xml?v=   Parameters:
a. version - XML schema version e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches.xml?v=1.0"http://app.toronto.ca/tpha/ws/beaches.xml?v=1.0 2. Latest report for a specific beach: 
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/%3cbeachId%3e.xml?v=%3cversion"http://app.toronto.ca/tpha/ws/beach/.xml?v=   Path variables: a. beachId - the ID of the beach as defined in the header Parameters:
a. version - XML schema version e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/1.xml?v=1.0"http://app.toronto.ca/tpha/ws/beach/1.xml?v=1.0 3. Historical data for all beaches for a specified period: 
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches/history.xml?v=%3cversion%3e&from=%3cfromDate%3e&to=%3ctoDate"http://app.toronto.ca/tpha/ws/beaches/history.xml?v=&from=&to=   Parameters:
a. version - XML schema version
b. fromDate - start date of period (YYYY-MM-DD)
c. toDate - end date of period (YYYY-MM-DD) e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches/history.xml?v=1.0&from=2010-06-10&to=2010-06-15"http://app.toronto.ca/tpha/ws/beaches/history.xml?v=1.0&from=2010-06-10&to=2010-06-15   4. Historical data for a specific beach for a specified period: 
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/%3cbeachId%3e/history.xml?v=%3cversion%3e&from=%3cfromDate%3e&to=%3ctoDate"http://app.toronto.ca/tpha/ws/beach//history.xml?v=&from=&to=   Path variables:
a. beachId - the ID of the beach as defined in the header Parameters:
a. version - XML schema version
b. fromDate - start date of period (YYYY-MM-DD)
c. toDate - end date of period (YYYY-MM-DD)   e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/1/history.xml?v=1.0&from=2010-06-10&to=2010-06-15"http://app.toronto.ca/tpha/ws/beach/1/history.xml?v=1.0&from=2010-06-10&to=2010-06-15   5. Entire history for all beaches: 
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches/history/all.xml?v=%3cversion"http://app.toronto.ca/tpha/ws/beaches/history/all.xml?v=   Parameters:
a. version - XML schema version e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beaches/history/all.xml?v=1.0"http://app.toronto.ca/tpha/ws/beaches/history/all.xml?v=1.0   6. Entire history for a specific beach:
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/%3cbeachId%3e/history/all.xml?v=%3cversion"http://app.toronto.ca/tpha/ws/beach//history/all.xml?v=   Path variables:
a. beachId - the ID of the beach as defined in the header Parameters:
a. version - XML schema version e.g.
HYPERLINK "http://app.toronto.ca/tpha/ws/beach/1/history/all.xml?v=1.0"http://app.toronto.ca/tpha/ws/beach/1/history/all.xml?v=1.0 
 Error Messages Service unavailable response: Service currently unavailable Invalid request response: invalid request XML Schema

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="tpha"> xs:complexType xs:sequence <xs:element ref="header"/> <xs:element ref="body"/> </xs:sequence> <xs:attribute ref="ver"/> </xs:complexType> </xs:element>

<xs:element name="header"> xs:complexType xs:sequence <xs:element ref="currentSeason"/> <xs:element ref="beachMeta" minOccurs="1" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element>

<xs:element name="currentSeason"> xs:complexType <xs:attribute name="startDate" type="xs:string"/> <xs:attribute name="endDate" type="xs:string"/> </xs:complexType> </xs:element>

<xs:element name="beachMeta"> xs:complexType <xs:attribute name="id" type="xs:positiveInteger"/> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="lat" type="xs:decimal"/> <xs:attribute name="lon" type="xs:decimal"/> </xs:complexType> </xs:element>

<xs:element name="body"> xs:complexType xs:sequence <xs:element ref="beachData" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element>

<xs:element name="beachData"> xs:complexType xs:sequence <xs:element name="sampleDate" type="xs:date"/> <xs:element name="publishDate" type="xs:string"/> <xs:element name="eColiCount" type="xs:string"/> <xs:element name="beachAdvisory" type="xs:string"/> <xs:element name="beachStatus" type="xs:string"/> </xs:sequence> <xs:attribute name="beachId" type="xs:positiveInteger"/> </xs:complexType> </xs:element>

</xs:schema> Data structure tpha – root ver – version of XML data schema header – beach information currentSeason – provides start and end dates for the current (or most recent season) startDate – start date of the season (YYYY-MM-DD) endDate – end date of the season (YYYY-MM-DD) beachMeta – provides beach related information id – the ID of the beach name – the name of the beach lat – the latitude of the beach long – the longitude for the beach body – beach data beachData – information about the status of a beach beachId – the ID of the beach as defined in the header publishDate – the date/time stamp when the beach status was published sampleDate – the date when the water samples were collected eColiCount – the E. coli count (ppm) beachAdvisory – official advisory text issued to the public beachStatus – beach status regarding swimming conditions

Clone this wiki locally