decode the response from api