A client library for the 📖StadtKatalog.
$ npm install @stadtkatalog/stadtkatalog
The following functions provide access to the StadtKatalog Open Data REST API:
Some functions use the REST API's Standard Query Parameters to paginate or scroll through query results.
This library is written in TypeScript and provides enumerations and interfaces to work with API responses.
// Retrieve a single entry with its metadata
const seesternEntry = await getEntry("100105");
// Retrieve only the entry's data
const seesternData = await getEntryData("100105");
// Export all entries inside the Seestadt geofence,
// including entry assets and with export page size 500
const seestadtAspern = await exportEntries(true, 500, "seestadt");
// Fulltext search over the whole StadtKatalog
const results = await searchFulltext("Seestern");
// Fulltext search with the Seestadt geofence
const resultsSeestadt = await searchFulltext(
"Seestern",
SortField.relevance, // TypeScript enum
SortOrder.desc, // TypeScript enum
100,
0,
"seestadt"
);
The base URL and the HTTP client timeout can be changed with the following environment
variable (process.env
in Node):
STADTKATALOG_ENDPOINT
– defaults tohttps://app.stadtkatalog.org/opendata/v1
STADTKATALOG_CLIENT_TIMEOUT
– defaults to60000
ms
Use a webpack plugin variable to switch to a different base URL in client-side projects:
plugins: [
new webpack.DefinePlugin({
'process.env': {
'STADTKATALOG_ENDPOINT': '"https://example.com/opendata/v1"',
'STADTKATALOG_CLIENT_TIMEOUT': '10000'
}
})
]
This library has been compiled from TypeScript to JavaScript with the ES5
target.
You still need to provide polyfills for e.g. Promise
and Symbol
.
ISC – StadtKatalog.org / Philipp Naderer-Puiu