implemented discovery of api and add it to cache