-
-
Notifications
You must be signed in to change notification settings - Fork 241
Open311 FMS Complete Spec
This page details the full spec for Open311 GeoReport with mySociety's proposed extensions. The standard Open311 GeoReport specification is available on the Open311 wiki.
Please also see/consider https://github.com/mysociety/fixmystreet/wiki/Open311-FMS-Additional-states for extending beyond "open" and "closed" states.
An OpenAPI/Swagger version of this document can be found at https://pages.mysociety.org/fixmystreet.com/open311-openapi/
GeoReport v2 and subsequent Open311 APIs are also required to have a standard service discovery file associated with them to provide routing between versions and types of APIs. See the Service Discovery page for details of the specification.
Date/time format 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:
-
1994-11-05T08:15:30-05:00
corresponds to November 5, 1994, 8:15:30 am, US Eastern Standard Time. -
1994-11-05T13:15:30Z
corresponds to the same instant.
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. Examples of the HTTP content-type headers for each format are shown below under Format Support.
XML is a required format, but JSON can be provided at the discretion of the API provider. The output formats supported by the provider are indicated through the Service Discovery formats field for the API endpoint being used. The client can specify the desired format by appending the format name to the resource. For example a GET request to /services.xml
for text/xml
output from the services resource and /services/01.json
for application/json
(RFC 4627) output for a specific service definition.
The HTTP content-type headers should look like this for each format:
- POST Service Request:
Content-Type: application/x-www-form-urlencoded; charset=utf-8
- POST Service Request Update:
Content-Type: application/x-www-form-urlencoded; charset=utf-8
- XML:
Content-Type: text/xml; charset=utf-8
- JSON:
Content-Type: application/json; charset=utf-8
XML for the API should be Content-Type: text/xml
. The XML output currently defined is schemaless and without a namespace declaration. For now, extending the output with additional namespaces should be done at your own risk. To guarantee that all clients can support the XML output, it is recommended that you adhere to the specification strictly and do not include foreign tags or namespaces. It is also assumed that the default namespace is not specified, but if it must be specified, the XMLNS URI is the URL of the specification: https://wiki.open311.org/GeoReport_v2
JSON for the API should be Content-Type: application/json
. JSON support is based on a programmatic mapping of the XML format using the Spark Convention. This means that if you have an XML file, you can easily generate the JSON version with XSL. This can be done using a server side XSLT.
The use of HTTPS is mandatory.
As a means to allow this API to distinguish multiple jurisdictions within one API endpoint 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.
Purpose | provide a list of acceptable 311 service request types and their associated service codes. These request types can be unique to the city/jurisdiction. |
---|---|
URL | https://[API endpoint]/services.[format] |
Sample URL | https://api.city.gov/dev/v2/services.xml?jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions |
Field Name | Description | Notes & Requirements |
---|---|---|
services ⇊ | ||
service ↴ | ||
|
The unique identifier for the service request type | |
|
The human readable name of the service request type | |
|
A brief description of the service request type. | |
|
Determines whether there are additional form fields for this service type.
|
Possible values: true, false. |
|
|
Possible values: realtime, batch, blackbox. |
|
A comma separated list of tags or keywords to help users identify the request type. This can provide synonyms of the service_name and group. | |
|
A category to group this service type within. This provides a way to group several service request types under one category such as "sanitation" |
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id provided was not found (specify in error response)
- 400 - jurisdiction_id was not provided (specify in error response)
- 400 - General service error (Anything that fails during service list processing. The client will need to notify us)
<?xml version="1.0" encoding="utf-8"?>
<services>
<service>
<service_code>001</service_code>
<service_name>Cans left out 24x7</service_name>
<description>Garbage or recycling cans that have been left out for more than 24 hours after collection. Violators will be cited.</description>
<metadata>true</metadata>
<type>realtime</type>
<keywords>lorem, ipsum, dolor</keywords>
<group>sanitation</group>
</service>
<service>
<service_code>002</service_code>
<metadata>true</metadata>
<type>realtime</type>
<keywords>lorem, ipsum, dolor</keywords>
<group>street</group>
<service_name>Construction plate shifted</service_name>
<description>Metal construction plate covering the street or sidewalk has been moved.</description>
</service>
<service>
<service_code>003</service_code>
<metadata>true</metadata>
<type>realtime</type>
<keywords>lorem, ipsum, dolor</keywords>
<group>street</group>
<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>
</service>
</services>
Conditional | Yes - This call is only necessary if the Service selected has metadata set as true from the GET Services response |
---|---|
Purpose | Define attributes associated with a service code. These attributes can be unique to the city/jurisdiction. |
URL | https://[API endpoint]/services/[service_code].[format] |
Sample URL | https://api.city.gov/dev/v2/services/033.xml?jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
The service_code is specified in the main URL path rather than an added query string parameter. |
Field Name | Description | Notes & Requirements |
---|---|---|
service_definition ↴ | ||
|
Returns the service_code associated with the definition, the same one submitted for this call. | |
attributes ⇊ | ||
attribute ↴ | ||
|
|
Possible values: true, false. |
|
A unique identifier for the attribute | |
|
Denotes the type of field used for user input.
|
Options: string, number, datetime, text, singlevaluelist, multivaluelist. |
|
|
Options: true, false. |
|
A description of the datatype which helps the user provide their input | |
|
The sort order that the attributes will be presented to the user. 1 is shown first in the list. | Any positive integer not used for other attributes in the same service_code |
|
|
See Open311-FMS-Service-Definition-additions for more information |
|
An description of the attribute field with instructions for the user to find and identify the requested information | |
values ⇊ | ||
value ↴ | ||
|
The unique identifier associated with an option for singlevaluelist or multivaluelist. This is analogous to the value attribute in an html option tag. | |
|
The human readable title of an option for singlevaluelist or multivaluelist. This is analogous to the innerhtml text node of an html option tag. |
The numbers represent the HTTP status code returned for each error type:
- 404 - service_code or jurisdiction_id provided were not found (specify in error response)
- 400 - service_code or jurisdiction_id was not provided (specify in error response)
- 400 - General service error (Anything that fails during service list processing. The client will need to notify us)
<?xml version="1.0" encoding="utf-8"?>
<service_definition>
<service_code>DMV66</service_code>
<attributes>
<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>
Purpose | Create service requests |
---|---|
URL | https://[API endpoint]/requests.[format] |
Sample URL | https://api.city.gov/dev/v2/requests.xml |
Format sent | Content-Type: application/x-www-form-urlencoded |
Formats returned | XML (JSON available if denoted by Service Discovery) |
HTTP Method | POST |
Requires API Key | Yes |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
This is obtained from GET Service List method | |
|
A full location parameter must be submitted. | One of lat & long or address_string or address_id |
|
An array of key/value responses based on Service Definitions. | This takes the form of attribute[code]=value where multiple code/value pairs can be specified as well as multiple values for the same code in the case of a multivaluelist datatype (attribute[code1][]=value1&attribute[code1][]=value2&attribute[code1][]=value3) - see example. This is only required if the service_code requires a service definition with required fields. |
Field Name | Description | Notes & Requirements |
---|---|---|
|
Latitude using the (WGS84) projection. | lat & long both need to be sent even though they are sent as two separate parameters. lat & long are required if no address_string or address_id is provided. |
|
Longitude using the (WGS84) projection. | lat & long both need to be sent even though they are sent as two separate parameters. lat & long are required if no address_string or address_id is provided. |
|
Human entered address or description of location. | This is required if no lat/long or address_id are provided. This should be written from most specific to most general geographic unit, eg address number or cross streets, street name, neighborhood/district, city/town/village, county, postal code. |
|
The internal address ID used by a jurisdiction's master address repository or other addressing system. | This is required if no lat/long or address_string are provided. |
|
The email address of the person submitting the request | |
|
The unique device ID of the device submitting the request. This is usually only used for mobile devices. | Android devices can use TelephonyManager.getDeviceId() and iPhones can use [UIDevice currentDevice].uniqueIdentifier |
|
The unique ID for the user account of the person submitting the request | |
|
The given name of the person submitting the request | |
|
The family name of the person submitting the request | |
|
The phone number of the person submitting the request | |
|
A full description of the request or report being submitted. | This may contain line breaks, but not html or code. Otherwise, this is free form text limited to 4,000 characters. |
|
A URL to media associated with the request, eg an image. | If the endpoint supports it, this parameter can be supplied multiple times. |
Field Name | Description | Notes & Requirements |
---|---|---|
service_requests ⇊ | ||
request ↴ | ||
|
The unique ID of the service request created. | This should not be returned if token is returned |
|
If returned, use this to call GET service_request_id from a token. | This should not be returned if service_request_id is returned |
|
Information about the action expected to fulfill the request or otherwise address the information reported. | May not be returned |
|
The unique ID for the user account of the person submitting the request. | May not be returned |
The numbers represent the HTTP status code returned for each error type:
- 404 - service_code or jurisdiction_id was not found (specified in error response)
- 400 - service_code or jurisdiction_id was not provided (specified in error response)
- 400 - General Service Error (Any failure during create request processing, eg CRM is down. Client will need to notify us)
POST /dev/v2/requests.xml
Host: api.city.gov
Content-Type: application/x-www-form-urlencoded; charset=utf-8
api_key=xyz&jurisdiction_id=city.gov&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
<?xml version="1.0" encoding="utf-8"?>
<service_requests>
<request>
<service_request_id>293944</service_request_id>
<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
</service_notice>
<account_id/>
</request>
</service_requests>
Conditional | Yes - This call is only necessary if the response from POST Service Request contains a token |
---|---|
Purpose | Get the service_request_id from a temporary token. This is unnecessary if the response from creating a service request does not contain a token. |
URL | https://[API endpoint]/tokens/[token id].[format] |
Sample URL | https://api.city.gov/dev/v2/tokens/123456.xml?jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
This is obtained from the POST Service Requests method |
Field Name | Description | Notes & Requirements |
---|---|---|
service_requests ⇊ | ||
request ↴ | ||
|
The unique ID for the service request created. This can be used to call the GET Service Request method. | |
|
The token ID used to make this call. |
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id or token not found (specified in error response)
- 400 - jurisdiction_id or token was not provided (specified in error response)
- 400 - General Service error (Any failure during service query processing. Client will have to notify us)
<?xml version="1.0" encoding="utf-8"?>
<service_requests>
<request>
<service_request_id>638344</service_request_id>
<token>12345</token>
</request>
</service_requests>
Purpose | Query the current status of multiple requests |
---|---|
URL | https://[API endpoint]/requests.[format] |
Sample URL | https://api.city.gov/dev/v2/requests.xml?start_date=2010-05-24T00:00:00Z&end_date=2010-06-24T00:00:00Z&status=open&jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions |
Field Name | Description | Notes & Requirements |
---|---|---|
|
To call multiple Service Requests at once, multiple service_request_id can be declared; comma delimited. | This overrides all other arguments. |
|
Specify the service type by calling the unique ID of the service_code. | This defaults to all service codes when not declared; can be declared multiple times, comma delimited |
|
Earliest datetime to include in search. When provided with end_date, allows one to search for requests which have a requested_datetime that matches a given range, but may not span more than 90 days. | When not specified, the range defaults to most recent 90 days. Must use w3 format, eg 2010-01-01T00:00:00Z. |
|
Latest datetime to include in search. When provided with start_date, allows one to search for requests which have a requested_datetime that matches a given range, but may not span more than 90 days. | When not specified, the range defaults to most recent 90 days. Must use w3 format, eg 2010-01-01T00:00:00Z. |
|
Allows one to search for requests which have a specific status. This defaults to all statuses; can be declared multiple times, comma delimited; | Options: open, closed |
Field Name | Description | Notes & Requirements |
---|---|---|
service_requests ⇊ | ||
request ↴ | ||
|
The unique ID of the service request created. | |
|
The current status of the service request.
|
Options: open, closed |
|
Explanation of why status was changed to current state or more details on current status than conveyed with status alone. | May not be returned |
|
The human readable name of the service request type | |
|
The unique identifier for the service request type | |
|
A full description of the request or report submitted. | This may contain line breaks, but not html or code. Otherwise, this is free form text limited to 4,000 characters. |
|
The agency responsible for fulfilling or otherwise addressing the service request. | May not be returned |
|
Information about the action expected to fulfill the request or otherwise address the information reported. | May not be returned |
|
The date and time when the service request was made. | Returned in w3 format, eg 2010-01-01T00:00:00Z |
|
The date and time when the service request was last modified. For requests with status=closed, this will be the date the request was closed. | Returned in w3 format, eg 2010-01-01T00:00:00Z |
|
The date and time when the service request can be expected to be fulfilled. This may be based on a service-specific service level agreement. | May not be returned |
|
Human readable address or description of location. | This should be provided from most specific to most general geographic unit, eg address number or cross streets, street name, neighborhood/district, city/town/village, county, postal code. |
|
The internal address ID used by a jurisdictions master address repository or other addressing system. | |
|
The postal code for the location of the service request. | |
|
latitude using the (WGS84) projection. | |
|
longitude using the (WGS84) projection. | |
|
A URL to media associated with the request, eg an image. | A convention for parsing media from this URL has yet to be established, so currently it will be done on a case by case basis much like Twitter.com does. For example, if a jurisdiction accepts photos submitted via Twitpic.com, then clients can parse the page at the Twitpic URL for the image given the conventions of Twitpic.com. This could also be a URL to a media RSS feed where the clients can parse for media in a more structured way. |
Default query limit is a span of 90 days or first 1000 requests returned, whichever is smallest.
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id not found (specified in error response)
- 400 - jurisdiction_id was not provided (specified in error response)
- 400 - General Service error (Any failure during service query processing. Client will have to notify us)
<?xml version="1.0" encoding="utf-8"?>
<service_requests>
<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>https://city.gov.s3.example.com/requests/media/638344.jpg </media_url>
</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>https://city.gov.s3.example.com/requests/media/638349.jpg </media_url>
</request>
</service_requests>
Purpose | Query the current status of an individual request |
---|---|
URL | https://[API endpoint]/requests/[service_request_id].[format] |
Sample URL | https://api.city.gov/dev/v2/requests/123456.xml?jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
The service_request_id is specified in the main URL path rather than an added query string parameter. |
None
Field Name | Description | Notes & Requirements |
---|---|---|
service_requests ⇊ | ||
request ↴ | ||
|
The unique ID of the service request created. | |
|
The current status of the service request.
|
Options: open, closed |
|
Explanation of why status was changed to current state or more details on current status than conveyed with status alone. | May not be returned |
|
The human readable name of the service request type | |
|
The unique identifier for the service request type | |
|
A full description of the request or report submitted. | This may contain line breaks, but not html or code. Otherwise, this is free form text limited to 4,000 characters. |
|
The agency responsible for fulfilling or otherwise addressing the service request. | May not be returned |
|
Information about the action expected to fulfill the request or otherwise address the information reported. | May not be returned |
|
The date and time when the service request was made. | Returned in w3 format, eg 2010-01-01T00:00:00Z |
|
The date and time when the service request was last modified. For requests with status=closed, this will be the date the request was closed. | Returned in w3 format, eg 2010-01-01T00:00:00Z |
|
The date and time when the service request can be expected to be fulfilled. This may be based on a service-specific service level agreement. | May not be returned |
|
Human readable address or description of location. | This should be provided from most specific to most general geographic unit, eg address number or cross streets, street name, neighborhood/district, city/town/village, county, postal code. |
|
The internal address ID used by a jurisdictions master address repository or other addressing system. | |
|
The postal code for the location of the service request. | |
|
latitude using the (WGS84) projection. | |
|
longitude using the (WGS84) projection. | |
|
A URL to media associated with the request, eg an image. | A convention for parsing media from this URL has yet to be established, so currently it will be done on a case by case basis much like Twitter.com does. For example, if a jurisdiction accepts photos submitted via Twitpic.com, then clients can parse the page at the Twitpic URL for the image given the conventions of Twitpic.com. This could also be a URL to a media RSS feed where the clients can parse for media in a more structured way. |
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id not found (specified in error response)
- 400 - jurisdiction_id was not provided (specified in error response)
- 400 - General Service error (Any failure during service query processing. Client will have to notify us)
<?xml version="1.0" encoding="utf-8"?>
<service_requests>
<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>https://city.gov.s3.example.com/requests/media/638344.jpg </media_url>
</request>
</service_requests>
Purpose | Fetch a list of recent updates to Requests |
---|---|
URL | https://[API endpoint]/servicerequestupdates.[format] |
Sample URL | https://api.city.example.com/dev/v2.1/servicerequestupdates?start_date=2010-05-24T00:00:00Z&end_date=2010-06-24T00:00:00Z&jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions |
Field Name | Description | Notes & Requirements |
---|---|---|
|
Earliest update to include in returned results | In W3 format |
|
Latest update to include in returned results | In W3 format |
Field Name | Description | Notes & Requirements |
---|---|---|
service_request_updates ⇊ | ||
request_update ↴ | ||
|
The ID of the service request update. | |
|
The ID of the service request that the update is for. | |
|
The status of the service request after the update. | Possible values: OPEN, CLOSED |
|
The datetime of the update. | In W3 format |
|
The text of the update. | |
|
The URL of any associated media, e.g an image |
The default query limit is a span of 24 hours or the first thousand requests, whichever is smallest.
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id not found
- 400 - jurisdiction_id was not provided
- 400 - General service error
<?xml version="1.0" encoding="utf-8"?>
<service_request_updates>
<request_update>
<update_id>20474</update_id>
<service_request_id>2934</service_request_id>
<status>OPEN</status>
<updated_datetime>2010-04-14T10:37:38-01:00</updated_datetime>
<description>This problem has been scheduled for inspection</description>
</request_update>
<request_update>
<update_id>20473</update_id>
<service_request_id>2937</service_request_id>
<status>OPEN</status>
<updated_datetime>2010-04-14T10:23:54-01:00</updated_datetime>
<description>An engineering team will be starting work shortly</description>
</request_update>
<request_update>
<update_id>20472</update_id>
<service_request_id>2930</service_request_id>
<status>CLOSED</status>
<updated_datetime>2010-04-14T10:07:45-01:00</updated_datetime>
<description>This pothole has been repaired.</description>
</request_update>
<request_update>
<update_id>20471</update_id>
<service_request_id>2934</service_request_id>
<status>OPEN</status>
<updated_datetime>2010-04-14T09:52:21-01:00</updated_datetime>
<description>Awaiting shceduling of inspection team.</description>
</request_update>
</service_request_updates>
Purpose | Post an update to a service request |
---|---|
URL | https://[API endpoint]/servicerequestupdates.[format] |
Sample URL | https://api.city.gov/dev/v2/servicerequestupdates.xml |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | POST |
Requires API Key | Yes |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
The id of the update | |
|
The ID of the service request the update is for | This should be the service_request_id returned from a previous POST ServiceRequest call |
|
The date and time of the update | In W3 format |
|
The status of the service request after the update | Possible values: OPEN or CLOSED |
|
The message associated with the update |
Field Name | Description | Notes & Requirements |
---|---|---|
The email address of the person submitting the update | ||
|
The phone number of the person submitting the update | |
|
The last name of the person leaving the update | |
|
The first name of the person leaving the update | |
|
The title of the person leaving the report | |
|
The URL of any associated media, e.g a photograph | |
|
The unique ID for the user account of the person submitting the update |
Field Name | Description | Notes & Requirements |
---|---|---|
service_request_updates ⇊ | ||
request_update ↴ | ||
|
The ID of the service request update. | This should not be returned if token is returned |
|
If returned use this to call GET update_id from a token. | This should not be returned if service_request_id is returned |
|
The unique ID for the user account of the person submitting the request | May not be returned |
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id or service_request_id not found (specified in error message)
- 400 - Required argument was not provided (specified in error message)
- 400 - General service error
POST /v2.1/servicerequestupdates.xml
HOST api.city.gov
Content-Tpe: application/x-www-form-urlencoded; charset=utf-8
api_key=xyz&jurisdiction_id=city.gov&update_id=13456&service_request_id=1934&status=OPEN&description=The+pothole+has+got+much+larger&updated_datetime=2010-04-14T10:33:11-01:00&email=user%40example.com&last_name=User&first_name=A
<?xml version="1.0" encoding="utf-8"?>
<service_request_updates>
<request_update>
<update_id>392732</update_id>
</request_update>
</service_request_updates>
Conditional | Yes - This call is only necessary if the response from POST Service Request Update contains a token |
---|---|
Purpose | Get the update_id from a temporary token. This is unnecessary if the response from creating a service request update does not contain a token. |
URL | https://[API endpoint]/update_tokens/[token id].[format] |
Sample URL | https://api.city.gov/dev/v2.1/update_tokens/123456.xml?jurisdiction_id=city.gov |
Formats | XML (JSON available if denoted by Service Discovery) |
HTTP Method | GET |
Requires API Key | No |
Field Name | Description | Notes & Requirements |
---|---|---|
|
This is only required if the endpoint serves multiple jurisdictions | |
|
This is obtained from the POST Service Request Update method |
The numbers represent the HTTP status code returned for each error type:
- 404 - jurisdiction_id or token not found (specified in error message)
- 400 - jurisdiction_id or token was not provided (specified in error message)
- 400 - General service error
<?xml version="1.0" encoding="utf-8"?>
<service_request_updates>
<request_update>
<update_id>392732</update_id>
<token>10393383</update_id>
</request_update>
</service_request_updates>
Field Name | Description | Notes & Requirements |
---|---|---|
service_request_updates ⇊ | ||
request_update ↴ | ||
|
The ID of the service request update. | |
|
The token used to make this call |
Field Name | Description | Notes & Requirements |
---|---|---|
errors ⇊ | ||
error ↴ | ||
|
The error code representing the type of error. In most cases, this should match the HTTP status code returned in the HTTP header. | |
|
A human readable description of the error that occurred. This is meant to be seen by the user. |
- 403 - Missing or Invalid API Key (specify in error message)
- 400 - The URL request is invalid or open311 service is not running or reachable. Client should notify us after checking URL
HTTP error codes are required, but the code in the response body shouldn't necessarily match the HTTP error code, so that more specific and unique error code identifiers can be used. The HTTP error codes should always be 404 for resources that don't exist, 403 for errors because of wrong or missing api_key and basically 400 for any other error where the request can not be fulfilled as expected. Multiple errors codes and descriptions can be returned in the body (the response is an array).
Example:
HTTP/1.1 403 Forbidden
<?xml version="1.0" encoding="utf-8"?>
<errors>
<error>
<code>403</code>
<description>Invalid api_key received -- can't proceed with create_request.</description>
</error>
</errors>
See http://fixmystreet.org/ for documentation