Connecting to API using multi-thread