API modified to handle nulls and return 404 response codes where a resource is not found