(→Servers (can receive reports)) |
(Updated with changes from Draft page: attributes container on get services and JSON examples (using the parker convention)) |
||
| Line 111: | Line 111: | ||
====Example response==== | ====Example response==== | ||
| + | <tabs> | ||
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| Line 140: | Line 142: | ||
<service_name>Curb or curb ramp defect</service_name> | <service_name>Curb or curb ramp defect</service_name> | ||
<description>Sidewalk curb or ramp has problems such as cracking, missing pieces, holes, and/or chipped curb.</description> | <description>Sidewalk curb or ramp has problems such as cracking, missing pieces, holes, and/or chipped curb.</description> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
</service> | </service> | ||
</services> | </services> | ||
| − | + | </pre> | |
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "services":[ | ||
| + | { | ||
| + | "service_code":001, | ||
| + | "service_name":"Cans left out 24x7", | ||
| + | "description":"Garbage or recycling cans that have been left out for more than 24 hours after collection. Violators will be cited.", | ||
| + | "metadata":true, | ||
| + | "type":"realtime", | ||
| + | "keywords":"lorem, ipsum, dolor", | ||
| + | "group":"sanitation" | ||
| + | }, | ||
| + | { | ||
| + | "service_code":002, | ||
| + | "metadata":true, | ||
| + | "type":"realtime", | ||
| + | "keywords":"lorem, ipsum, dolor", | ||
| + | "group":"street", | ||
| + | "service_name":"Construction plate shifted", | ||
| + | "description":"Metal construction plate covering the street or sidewalk has been moved." | ||
| + | }, | ||
| + | { | ||
| + | "service_code":003, | ||
| + | "metadata":true, | ||
| + | "type":"realtime", | ||
| + | "keywords":"lorem, ipsum, dolor", | ||
| + | "group":"street", | ||
| + | "service_name":"Curb or curb ramp defect", | ||
| + | "description":"Sidewalk curb or ramp has problems such as cracking, missing pieces, holes, and/or chipped curb." | ||
| + | } | ||
| + | ] | ||
| + | } | ||
</pre> | </pre> | ||
| + | |||
| + | </tab> | ||
| + | </tabs> | ||
===GET Service Definition=== | ===GET Service Definition=== | ||
| Line 434: | Line 203: | ||
**Parent: service_definition | **Parent: service_definition | ||
**Explanation: Returns the service_code associated with the definition, the same one submitted for this call. | **Explanation: Returns the service_code associated with the definition, the same one submitted for this call. | ||
| − | *''' | + | *'''attributes''' |
**Parent: service_definition | **Parent: service_definition | ||
| + | **Explanation: container for attribute | ||
| + | *'''attribute''' | ||
| + | **Parent: attributes | ||
**Explanation: container for the following elements: | **Explanation: container for the following elements: | ||
*'''variable''' | *'''variable''' | ||
| Line 491: | Line 263: | ||
====Example response==== | ====Example response==== | ||
| + | <tabs> | ||
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<service_definition> | <service_definition> | ||
<service_code>DMV66</service_code> | <service_code>DMV66</service_code> | ||
| − | < | + | <attributes> |
| − | <variable>true</variable> | + | <attribute> |
| − | + | <variable>true</variable> | |
| − | + | <code>WHISHETN</code> | |
| − | + | <datatype>singlevaluelist</datatype> | |
| − | + | <required>true</required> | |
| − | + | <datatype_description></datatype_description> | |
| − | + | <order>1</order> | |
| − | + | <description>What is the ticket/tag/DL number?</description> | |
| − | + | <values> | |
| − | + | <value> | |
| − | + | <key>123</key> | |
| − | + | <name>Ford</name> | |
| − | + | </value> | |
| − | + | <value> | |
| − | + | <key>124</key> | |
| − | + | <name>Chrysler</name> | |
| − | + | </value> | |
| − | + | </values> | |
| + | </attribute> | ||
| + | </attributes> | ||
</service_definition> | </service_definition> | ||
</pre> | </pre> | ||
| + | |||
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "service_definition":{ | ||
| + | "service_code":"DMV66", | ||
| + | "attributes":{ | ||
| + | "attribute":{ | ||
| + | "variable":true, | ||
| + | "code":"WHISHETN", | ||
| + | "datatype":"singlevaluelist", | ||
| + | "required":true, | ||
| + | "datatype_description":null, | ||
| + | "order":1, | ||
| + | "description":"What is the ticket/tag/DL number?", | ||
| + | "values":[ | ||
| + | { | ||
| + | "key":123, | ||
| + | "name":"Ford" | ||
| + | }, | ||
| + | { | ||
| + | "key":124, | ||
| + | "name":"Chrysler" | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | </tab> | ||
| + | </tabs> | ||
===POST Service Request=== | ===POST Service Request=== | ||
| Line 595: | Line 405: | ||
'''Example response:''' | '''Example response:''' | ||
| + | <tabs> | ||
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| Line 607: | Line 419: | ||
</service_requests> | </service_requests> | ||
</pre> | </pre> | ||
| + | |||
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "service_requests":{ | ||
| + | "request":{ | ||
| + | "service_request_id":293944, | ||
| + | "service_notice":"The City will inspect and require the responsible party to correct within 24 hours and/or issue a Correction Notice or Notice of Violation of the Public Works Code", | ||
| + | "account_id":null | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | |||
| + | </tab> | ||
| + | </tabs> | ||
===GET request_id from a token=== | ===GET request_id from a token=== | ||
| Line 642: | Line 470: | ||
====Example response==== | ====Example response==== | ||
| − | + | <tabs> | |
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
| Line 652: | Line 481: | ||
</service_requests> | </service_requests> | ||
</pre> | </pre> | ||
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "service_requests":{ | ||
| + | "request":{ | ||
| + | "service_request_id":638344, | ||
| + | "token":12345 | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | </tab> | ||
| + | </tabs> | ||
===GET Service Requests=== | ===GET Service Requests=== | ||
| Line 748: | Line 591: | ||
====Example response==== | ====Example response==== | ||
| + | <tabs> | ||
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<service_requests> | <service_requests> | ||
| − | <request> | + | <request> |
| − | + | <service_request_id>638344</service_request_id> | |
| − | + | <status>closed</status> | |
| − | + | <status_notes>Duplicate request.</status_notes> | |
| − | + | <service_name>Sidewalk and Curb Issues</service_name> | |
| − | + | <service_code>006</service_code> | |
| − | + | <description></description> | |
| − | + | <agency_responsible></agency_responsible> | |
| − | + | <service_notice></service_notice> | |
| − | + | <requested_datetime>2010-04-14T06:37:38-08:00</requested_datetime> | |
| − | + | <updated_datetime>2010-04-14T06:37:38-08:00</updated_datetime> | |
| − | + | <expected_datetime>2010-04-15T06:37:38-08:00</expected_datetime> | |
| − | + | <address>8TH AVE and JUDAH ST</address> | |
| − | + | <address_id>545483</address_id> | |
| − | + | <zipcode>94122</zipcode> | |
| − | + | <lat>37.762221815</lat> | |
| − | + | <long>-122.4651145</long> | |
| − | + | <media_url>http://open311.city.gov.s3.amazonaws.com/requests/media/638344.rss </media_url> | |
| − | </request> | + | </request> |
| − | <request> | + | <request> |
| − | + | <service_request_id>638349</service_request_id> | |
| − | + | <status>open</status> | |
| − | + | <status_notes></status_notes> | |
| − | + | <service_name>Sidewalk and Curb Issues</service_name> | |
| − | + | <service_code>006</service_code> | |
| − | + | <description></description> | |
| − | + | <agency_responsible></agency_responsible> | |
| − | + | <service_notice></service_notice> | |
| − | + | <requested_datetime>2010-04-19T06:37:38-08:00</requested_datetime> | |
| − | + | <updated_datetime>2010-04-19T06:37:38-08:00</updated_datetime> | |
| − | + | <expected_datetime>2010-04-19T06:37:38-08:00</expected_datetime> | |
| − | + | <address>8TH AVE and JUDAH ST</address> | |
| − | + | <address_id>545483</address_id> | |
| − | + | <zipcode>94122</zipcode> | |
| − | + | <lat>37.762221815</lat> | |
| − | + | <long>-122.4651145</long> | |
| − | + | <media_url>http://open311.city.gov.s3.amazonaws.com/requests/media/638349.rss </media_url> | |
| − | </request> | + | </request> |
</service_requests> | </service_requests> | ||
</pre> | </pre> | ||
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "service_requests":[ | ||
| + | { | ||
| + | "service_request_id":638344, | ||
| + | "status":"closed", | ||
| + | "status_notes":"Duplicate request.", | ||
| + | "service_name":"Sidewalk and Curb Issues", | ||
| + | "service_code":006, | ||
| + | "description":null, | ||
| + | "agency_responsible":null, | ||
| + | "service_notice":null, | ||
| + | "requested_datetime":"2010-04-14T06:37:38-08:00", | ||
| + | "updated_datetime":"2010-04-14T06:37:38-08:00", | ||
| + | "expected_datetime":"2010-04-15T06:37:38-08:00", | ||
| + | "address":"8TH AVE and JUDAH ST", | ||
| + | "address_id":545483, | ||
| + | "zipcode":94122, | ||
| + | "lat":37.762221815, | ||
| + | "long":-122.4651145, | ||
| + | "media_url":"http://open311.city.gov.s3.amazonaws.com/requests/media/638344.rss " | ||
| + | }, | ||
| + | { | ||
| + | "service_request_id":638349, | ||
| + | "status":"open", | ||
| + | "status_notes":null, | ||
| + | "service_name":"Sidewalk and Curb Issues", | ||
| + | "service_code":006, | ||
| + | "description":null, | ||
| + | "agency_responsible":null, | ||
| + | "service_notice":null, | ||
| + | "requested_datetime":"2010-04-19T06:37:38-08:00", | ||
| + | "updated_datetime":"2010-04-19T06:37:38-08:00", | ||
| + | "expected_datetime":"2010-04-19T06:37:38-08:00", | ||
| + | "address":"8TH AVE and JUDAH ST", | ||
| + | "address_id":545483, | ||
| + | "zipcode":94122, | ||
| + | "lat":37.762221815, | ||
| + | "long":-122.4651145, | ||
| + | "media_url":"http://open311.city.gov.s3.amazonaws.com/requests/media/638349.rss " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </pre> | ||
| + | </tab> | ||
| + | </tabs> | ||
===GET Service Request=== | ===GET Service Request=== | ||
| Line 875: | Line 768: | ||
====Example response==== | ====Example response==== | ||
| + | <tabs> | ||
| + | <tab title="XML"> | ||
<pre class="brush:xml"> | <pre class="brush:xml"> | ||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||
<service_requests> | <service_requests> | ||
| − | <request> | + | <request> |
| − | + | <service_request_id>638344</service_request_id> | |
| − | + | <status>closed</status> | |
| − | + | <status_notes>Duplicate request.</status_notes> | |
| − | + | <service_name>Sidewalk and Curb Issues</service_name> | |
| − | + | <service_code>006</service_code> | |
| − | + | <description></description> | |
| − | + | <agency_responsible></agency_responsible> | |
| − | + | <service_notice></service_notice> | |
| − | + | <requested_datetime>2010-04-14T06:37:38-08:00</requested_datetime> | |
| − | + | <updated_datetime>2010-04-14T06:37:38-08:00</updated_datetime> | |
| − | + | <expected_datetime>2010-04-15T06:37:38-08:00</expected_datetime> | |
| − | + | <address>8TH AVE and JUDAH ST</address> | |
| − | + | <address_id>545483</address_id> | |
| − | + | <zipcode>94122</zipcode> | |
| − | + | <lat>37.762221815</lat> | |
| − | + | <long>-122.4651145</long> | |
| − | + | <media_url>http://open311.city.gov.s3.amazonaws.com/requests/media/638344.rss </media_url> | |
| − | </request> | + | </request> |
| − | + | ||
</service_requests> | </service_requests> | ||
</pre> | </pre> | ||
| + | </tab> | ||
| + | <tab title="JSON"> | ||
| + | <pre class="brush:js"> | ||
| + | { | ||
| + | "service_requests":{ | ||
| + | "request":{ | ||
| + | "service_request_id":638344, | ||
| + | "status":"closed", | ||
| + | "status_notes":"Duplicate request.", | ||
| + | "service_name":"Sidewalk and Curb Issues", | ||
| + | "service_code":006, | ||
| + | "description":null, | ||
| + | "agency_responsible":null, | ||
| + | "service_notice":null, | ||
| + | "requested_datetime":"2010-04-14T06:37:38-08:00", | ||
| + | "updated_datetime":"2010-04-14T06:37:38-08:00", | ||
| + | "expected_datetime":"2010-04-15T06:37:38-08:00", | ||
| + | "address":"8TH AVE and JUDAH ST", | ||
| + | "address_id":545483, | ||
| + | "zipcode":94122, | ||
| + | "lat":37.762221815, | ||
| + | "long":-122.4651145, | ||
| + | "media_url":"http://open311.city.gov.s3.amazonaws.com/requests/media/638344.rss " | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | </tab> | ||
| + | </tabs> | ||
===Errors=== | ===Errors=== | ||
This spec is still in beta, please follow the Discuss List to follow its status.
The GeoReport API allows developers to build applications to report non-emergency issues such as graffiti, potholes, and street cleaning directly to government organizations like cities.
Beta: The GeoReport v2 Spec is being beta testing and is not yet stable for production.
Servers receive and manage reports on behalf of a jurisdiction.
Note that the URLs require a method and jurisdiction_id at the end, the root URL is not intended to be accessed directly.
| Name | Status | API Key | Dev API | Production API |
|---|---|---|---|---|
| San Francisco | Development Ready | Request Key | Dev URL | Production URL |
| Washington D.C. | Development Ready | - | - | Production URL |
All date/time fields must be formatted in a common subset of ISO 8601 as per the w3 note. Timezone information (either Z meaning UTC, or an HH:MM offset from UTC) must be included.
Examples:
UTF-8 is required everywhere.
All text returned by the service, whether in XML, JSON, or any other text-based content-type, MUST be encoded as UTF-8. Appropriate HTTP headers must be set, and the root element must be preceded with the XML declaration including the encoding="UTF-8" attribute. All text received by the service from the client will be assumed to be UTF-8 and must be decoded accordingly.
As a means to allow this API to distinguish multiple jurisdictions we've included a "jurisdiction_id" which will be the unique identifier for cities. It has been suggested that we use the jurisdiction's main website root url (without the www) as the "jurisdiction_id". For San Francisco, the jurisdiction_id is sfgov.org. Implementations can ignore this parameter and treat it as an "Optional Argument" if the implementation only serves one jurisdiction.
"Optional" means that the response should be the same whether a parameter is passed and is empty or is not passed at all. A null parameter should be treated as equivalent to a non-declared parameter in processing the request.
The numbers represent the HTTP status code returned for each error type:
The numbers represent the HTTP status code returned for each error type:
The numbers represent the HTTP status code returned for each error type:
POST /dev/v2/requests.xml Host: open311.sfgov.org Content-Type: application/x-www-form-urlencoded; charset=utf-8 api_key=xyz&jurisdiction_id=sfgov.org&service_code=001&lat=37.76524078&long=-122.4212043&address_string=1234+5th+street&email=smit333%40sfgov.edu&device_id=tt222111&account_id=123456&first_name=john&last_name=smith&phone=111111111&description=A+large+sinkhole+is+destroying+the+street&media_url=http%3A%2F%2Ffarm3.static.flickr.com%2F2002%2F2212426634_5ed477a060.jpg&attribute[WHISPAWN]=123456&attribute[WHISDORN]=COISL001
Example response:
The numbers represent the HTTP status code returned for each error type:
The numbers represent the HTTP status code returned for each error type:
The numbers represent the HTTP status code returned for each error type:
Response:
Example:
HTTP/1.1 403 Forbidden <?xml version="1.0" encoding="utf-8"?> <error>Invalid api_key received -- can't proceed with create_request.</error>