api-dispatch-request function