Adds an action hook for ajax requests via an api