It looks that you are making first API Call to soon, not having parameters ready. Try ro put some condition to fire this call when all required paramteres are ready