flatisfy.web.routes package

Submodules

flatisfy.web.routes.api module

This module contains the definition of the web app API routes.

flatisfy.web.routes.api.JSONError(error_code, error_str)[source]

Return an HTTP error with a JSON payload.

Parameters:
  • error_code – HTTP error code to return.
  • error_str – Error as a string.
Returns:

Set correct response parameters and returns JSON-serialized error content.

flatisfy.web.routes.api.flat_v1(flat_id, config, db)[source]

API v1 flat route.

Example:

GET /api/v1/flats/:flat_id
Returns:The flat object in a JSON data dict.
flatisfy.web.routes.api.flats_v1(config, db)[source]

API v1 flats route.

Example:

GET /api/v1/flats

Note

Filtering can be done through the filter GET param, according to JSON API spec (http://jsonapi.org/recommendations/#filtering).

Note

By default no pagination is done. Pagination can be forced using page[size] to specify a number of items per page and page[number] to specify which page to return. Pages are numbered starting from 0.

Note

Sorting can be handled through the sort GET param, according to JSON API spec (http://jsonapi.org/format/#fetching-sorting).

Returns:The available flats objects in a JSON data dict.
flatisfy.web.routes.api.ics_feed_v1(config, db)[source]

API v1 ICS feed of visits route.

Example:

GET /api/v1/ics/visits.ics
Returns:The ICS feed for the visits.
flatisfy.web.routes.api.index_v1()[source]

API v1 index route.

Example:

GET /api/v1/
flatisfy.web.routes.api.metadata_v1(config)[source]

API v1 metadata of the application.

Example:

GET /api/v1/metadata
Returns:The application metadata.
flatisfy.web.routes.api.opendata_index_v1()[source]

API v1 data index route.

Example:

GET /api/v1/opendata
flatisfy.web.routes.api.opendata_postal_codes_v1(db)[source]

API v1 data postal codes route.

Example:

GET /api/v1/opendata/postal_codes

Note

Filtering can be done through the filter GET param, according to JSON API spec (http://jsonapi.org/recommendations/#filtering).

Note

By default no pagination is done. Pagination can be forced using page[size] to specify a number of items per page and page[number] to specify which page to return. Pages are numbered starting from 0.

Note

Sorting can be handled through the sort GET param, according to JSON API spec (http://jsonapi.org/format/#fetching-sorting).

Returns:The postal codes data from opendata.
flatisfy.web.routes.api.search_v1(db, config)[source]

API v1 route to perform a fulltext search on flats.

Example:

POST /api/v1/search
Data: {
    "query": "SOME_QUERY"
}

Note

Filtering can be done through the filter GET param, according to JSON API spec (http://jsonapi.org/recommendations/#filtering).

Note

By default no pagination is done. Pagination can be forced using page[size] to specify a number of items per page and page[number] to specify which page to return. Pages are numbered starting from 0.

Note

Sorting can be handled through the sort GET param, according to JSON API spec (http://jsonapi.org/format/#fetching-sorting).

Returns:The matching flat objects in a JSON data dict.
flatisfy.web.routes.api.time_to_places_v1(config)[source]

API v1 route to fetch the details of the places to compute time to.

Example:

GET /api/v1/time_to_places
Returns:The JSON dump of the places to compute time to (dict of places names mapped to GPS coordinates).
flatisfy.web.routes.api.update_flat_v1(flat_id, config, db)[source]

API v1 route to update flat status.

Example:

PATCH /api/v1/flat/:flat_id
Data: {
    "status": "NEW_STATUS",
    "visit_date": "ISO8601 DATETIME"
}

Note

The keys in the data sent are same keys as in Flat model. You can provide any subset of them to update part of the flat infos.

Returns:The new flat object in a JSON data dict.

Module contents