Retrying an API call if a condition is not met

Linking a relevant example: