match GET or POST method for api