"No JSON object could be decoded" error while creating an API