Do not assum rest connection to be established

Added a check to verify that rest connection is correctly initialized,
preventing a segmentation fault.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>