-
-
Notifications
You must be signed in to change notification settings - Fork 242
Open311 FMS Service Definition additions
If private
is included in the keywords of a particular service returned by the GET Service List call, then it will be marked as non_public
on FixMyStreet, which means reports made in that category will be automatically hidden from anyone except the reporter and staff.
<!-- GET /services.xml -->
<?xml version="1.0" encoding="utf-8"?>
<services>
<service>
<service_code>BLOCKED_DRAIN</service_code>
<service_name>Blocked drain</service_name>
<description>Issues with blocked drains</description>
<metadata>true</metadata>
<type>realtime</type>
<group>Flooding</group>
<keywords>private</keywords>
</service>
</services>
FixMyStreet can also handle an Open311 service that, for a GET Service List call response, includes multiple groups for a particular service by looking for a groups
element containing one or more group
elements.
<!-- GET /services.xml -->
<?xml version="1.0" encoding="utf-8"?>
<services>
<service>
<service_code>BLOCKED_DRAIN</service_code>
<service_name>Blocked drain</service_name>
<description>Issues with blocked drains</description>
<metadata>true</metadata>
<type>realtime</type>
<groups>
<group>Flooding</group>
<group>Drainage</group>
</groups>
</service>
</services>
FixMyStreet can handle an additional optional <automated>
element to any <attribute>
returned by a GET Service Definition call.
This additional field can be either blank, or set to hidden_field
or server_set
.
If set to hidden_field
, then the attribute will be output on the FixMyStreet website during the reporting process as a hidden input field with no label, rather than a visible one as is the default. This is meant for attributes where the expectation is that it might be filled in automatically with e.g. a selected asset or nearest road identifier.
This example adds a site_code
hidden field which could then, for example, be populated with the selected asset ID using some custom code in FixMyStreet.
<!-- GET /services/BLOCKED_DRAIN.xml -->
<?xml version="1.0" encoding="utf-8"?>
<service_definition>
<service_code>BLOCKED_DRAIN</service_code>
<attributes>
<attribute>
<automated>hidden_field</automated>
<code>site_code</code>
<datatype>string</datatype>
<datatype_description></datatype_description>
<description>Site code</description>
<order>1</order>
<required>false</required>
<variable>true</variable>
</attribute>
</attributes>
</service_definition>
If set to server_set
, then the attribute is not output on the FixMyStreet website during the reporting process at all. This is meant for attributes where the Open311 sending process will automatically fill in the required information. Default processing exists for attributes with codes as follows:
Code | Description |
---|---|
easting | The report's easting co-ordinate |
northing | The report's northing co-ordinate |
fixmystreet_id | The report's FixMyStreet ID |
Other fields can be added with custom processing; examples include the report title/description (if those are required separately; by default Open311 puts them together in one field), or the report's URL.
This example shows how to enable the easting,
northing
and fixmystreet_id
attributes.
With the below service definition in place, FixMyStreet would automatically include attribute[easting]
, attribute[northing]
and attribute[fixmystreet_id]
when doing a POST service request for that service.
<!-- GET /services/BLOCKED_DRAIN.xml -->
<?xml version="1.0" encoding="utf-8"?>
<service_definition>
<service_code>BLOCKED_DRAIN</service_code>
<attributes>
<attribute>
<automated>server_set</automated>
<code>fixmystreet_id</code>
<datatype>string</datatype>
<datatype_description />
<description>FixMyStreet ID</description>
<order>1</order>
<required>true</required>
<variable>false</variable>
</attribute>
<attribute>
<code>easting</code>
<datatype>number</datatype>
<datatype_description />
<description>Easting</description>
<order>0</order>
<required>false</required>
<variable>true</variable>
</attribute>
<attribute>
<code>northing</code>
<datatype>number</datatype>
<datatype_description />
<description>Northing</description>
<order>0</order>
<required>false</required>
<variable>true</variable>
</attribute>
</attributes>
</service_definition>
See http://fixmystreet.org/ for documentation