build the function with httparty