Fixed usage of wrong ip variable in API call