Added retry in the event of http error

Parameterised retry in the event of http error from api