connecting with api