(adding json for get token) |
m (Protected "GeoReport v2 Draft": Freezing this page because v2 has been frozen. ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 591: | 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 718: | 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 page is for making proposals regarding the main GeoReport v2 spec since that page is locked for editing
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>