Changed switch-case in api.js