added functions for accepting JSON data in api.py