Factorize rest request in order to call it dynamicaly