Added json not authorized callback for api and json calls
updated json error to respond only to json