Commit f9d565f6 authored by Cédric Bonhomme's avatar Cédric Bonhomme

Implemented where/bizLocation for EPCIS events.

parent 6f2a70b3
......@@ -29,11 +29,19 @@ def what(epc=None):
return jsonify(result="ok", epcis_events=epcis_events)
@app.route('/where/<string:epc>', methods=['GET'])
def where(epc=None):
@app.route('/where/<string:location>', methods=['GET'])
def where(location=None):
"""
Return all EPCIS events at 'bizLocation'.
"""
pass
result = models.EPCISEvent.objects()
epcis_events = [epcis_event.data for epcis_event in result if \
location in epcis_event.data["ObjectEvent"]["bizLocation"].values()] # or "readPoint" instead of "bizLocation"
if len(epcis_events) == 0:
return jsonify(result="no epcis event")
return jsonify(result="ok", epcis_events=epcis_events)
@app.errorhandler(404)
def not_found(error=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment