diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Open311.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index 841330e92..b4b5d5e3a 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -111,8 +111,6 @@ sub get_discovery : Private { { 'contact' => ["Send email to $contact_email."], 'changeset' => [$prod_changeset], - # XXX rewrite to match - 'key_service' => ["Read access is open to all according to our \u003Ca href='/open_data' target='_blank'\u003Eopen data license\u003C/a\u003E. For write access either: 1. return the 'guid' cookie on each call (unique to each client) or 2. use an api key from a user account which can be generated here: http://seeclickfix.com/register The unversioned url will always point to the latest supported version."], 'max_requests' => [ $c->config->{OPEN311_LIMIT} || 1000 ], 'endpoints' => [ { @@ -195,9 +193,7 @@ sub get_services : Private { ); } $c->forward( 'format_output', [ { - 'services' => [ { - 'service' => \@services - } ] + 'services' => \@services } ] ); } @@ -291,9 +287,7 @@ sub output_requests : Private { } $c->forward( 'format_output', [ { - 'requests' => [ { - 'request' => \@problemlist - } ] + service_requests => \@problemlist } ] ); } @@ -429,7 +423,21 @@ sub format_output : Private { $c->res->body( encode_json($hashref) ); } elsif ('xml' eq $format) { $c->res->content_type('application/xml; charset=utf-8'); - $c->res->body( XMLout($hashref, RootName => undef, NoAttr => 1 ) ); + my $group_tags = { + services => 'service', + attributes => 'attribute', + values => 'value', + service_requests => 'request', + errors => 'error', + service_request_updates => 'request_update', + }; + $c->res->body( XMLout($hashref, + KeyAttr => {}, + GroupTags => $group_tags, + SuppressEmpty => undef, + RootName => undef, + NoAttr => 1, + ) ); } else { $c->detach( 'error', [ sprintf(_('Invalid format %s specified.'), $format) |