Further information about the cityscore micro services.
There are 2 views which drive the get
requests for the endpoints.
The views have a dependency on the views_php
contributed module.
These views are defined at: /admin/structure/views/view/cityscore/edit
.
Display: Cityscore.
This display provides a full Drupal page containing the current cityscore table of metrics. The "page" URL for this is /rest/cityscore/html-table
. Because this is a fully themed Drupal page, it is more usual for the endpoint /rest/cityscore/html
to be used, as that endpoint provides just the <table>
HTML wrapped in a <div>
tag.
Display: JSON Output.
This display provides a JSON array with a single object being the current Cityscore total. The current Cityscore total is the mathematical average (mean) of all current non-null metrics.
This view is available at the endpoint /cityscore/totals/latest.json
. Because this is the output from a view, the JSON string is wrapped as an array. For backwards compatibility the endpoint /rest/cityscore/json
is used.
The endpoints provided at rest/cityscore/load
, /rest/cityscore/html
and /rest/cityscore/json
are all tracked on google analytics. Filter for pageviews named "/api".
Cityscore is a CoB city-performance metric devised by the Mayors office, calculated and managed by the analytics team.
Drupal (via https://www.boston.gov) is used to provide a public endpoint or micro service which can be used by other departments or external organizations to retrieve current cityscore data for use in their own applications.
POST
https://www.boston.gov/rest/cityscore/load
This secure endpoint is used by analytics to load and update the current cityscore data.
Payload Format.
GET
https://www.boston.gov/rest/cityscore/json
This public endpoint returns the latest cityscore indicator value.
GET
https://www.boston.gov/rest/cityscore/html
This public endpoint returns an HTML string which contains a cityscore metric table using the CoB style.
Name | Type | Description |
---|---|---|
payload
string
A JSON formatted array of cityscore metric objects.
api-key
string
Authentication token