DRYing api a little bit