-
Notifications
You must be signed in to change notification settings - Fork 9
dataSources
andy.rothwell edited this page Aug 27, 2018
·
10 revisions
Defines APIs used to pull data and related records for an address.
There are 4 kinds of dataSource retrievals:
Example:
dataSources: {
// each source has a unique key, e.g. `opa`
opa: {
// the type of call to make
type: 'http-get',
// the base url of the api
url: 'https://data.phila.gov/resource/w7rb-qrn8.json',
// all options
options: {
// query string parameters to be added to the url
params: {
// each param is mapped to a function that gets passed the current
// address feature. use attributes from this feature to form data queries.
// in this case, a param of `?parcel_number=<opa_account_num>` will be
// appended to the url.
parcel_number: function (feature) { return feature.properties.opa_account_num; }
},
// a callback that unpacks the desired record(s) from the api. this
// data will be kept in state and made available in the topic panel.
success: function (data) {
return data[0];
}
}
}
},